Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

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 situations when it can be helpful to work at a bit level. It’s particularly common when working with microcontrollers: because of the 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 operators are as follows:

  • << the left shift operator

  • >> the (signed) right shift operator.

  • >>> the (unsigned) right shift operator.