Bit Shifting involves using bitwise operators to manipulate the individual bits in data. Most of the time, we are not so concerned with values at such a granular level, but there are a number of situtations situations when it can be helpful to work at a bit level. It’s particularly common when working with microcontrollers: because of the limmited limited processing power and memory, we want to have every bit working for us. This is particularly the case when we are communicating with or between microcontrollers, and bandwidth is at premium.
First lets have a little refresh on bits and bytes:
The three bit shifting operaters operators are as follows:
<<
the left shift operator>>
the (signed) right shift operator.>>>
the (unsigned) right shift operator.