Home
Dictionary
Tags
Development
Programming Languages
Bit Shifting
Definition - What does
Bit Shifting
mean?
Bit shifting is an operation done on all the bits of a binary value in which they are moved by a determined number of places to either the left or right. Bit shifting is used when the operand is being used as a series of bits rather than as a whole. In other words, the operand is treated as individual bits that stand for something and not as a value.
Bit shifting is often used in programming and has at least one variation in each programming language.
Bit shifting may also be known as a bitwise operation
Techopedia explains
Bit Shifting
There are two variations to bit shifting, shift right and shift left, and it is further defined by the number of places in which the shift should occur. For example, shifting the operand one value to the left or shifting the bits "n" values to the right.
There are also two kinds of bit shifting, logical and arithmetic. Logical bit shifting may be useful for multiplying or dividing unsigned integers by powers of two. For example, if the value "0001" or "1" is shifted left, it becomes "0010" or "2", shifted to the left again it becomes "0100," or "4". Shifting to the right has an opposite effect of dividing the value by two per shift. In most cases, shifting is treated as circular so when shifting to the left, the leftmost value becomes the rightmost value, and vice versa.
Logical left shift and arithmetic left shift have the same effect so Java only has a single left shift operator (<<). The arithmetic right shift is (>>) while the logical is (>>>). In C and C++, there is only one shift right operator (>>); the kind of shift to be done is determined by the type of integer being shifted. Signed integers are shifted using arithmetic while logical bit shifting is used on unsigned integers. Bit shifting is also used a lot in assembly programming because microcontrollers and microprocessors usually rely on flags, which are represented by individual bits. Basically, it's because the binary number system is used in programming in assembly language that bit shifting becomes a commonly used operator.
Posted by:
Cory Janssen
Tweet
Tweet
Related Terms
Bitwise Operator (General Programming)
Binary Number System
Assembly Language
Related Videos
Related Links
Related White Papers
Other Resources
Related Tags
Categories:
Development
Microprocessors
Programming Languages
Recommended For You
close
Why APIs Have Become a Big Deal
Read More
ยป
Connect with us
Techopedia on Linkedin
Follow us on LinkedIn
Techopedia on Twitter
'@Techopedia'
Sign up for Techopedia's Free Newsletter!
Sign-In
Join Techopedia
Home
Dictionary
Articles
Tutorials
Newsletters
Menu
Home
Dictionary
Articles
Tech 101
How To
5 Things
IT Careers
History of Tech
Tutorials
Hot Trends
Big Data
Windows 8
Security
Cloud Computing
Data Centers
Mobile Computing
CRM
Green IT
Storage
Virtualization
Online Privacy
Job Roles
Developers
Network Admins
Database Admins
Tech Support
IT Management
Water Cooler
Infographics
Who To Follow
All Topics
Hacking
Online Marketing
Buzzwords and Jargon
Viruses
Operating Systems
Legal
People
Search Engines
World Wide Web
Personal Tech
Gaming
Linux
Internet