What is the difference between bit shifting and arithmetical operations?
- by Espuz
int aNumber;
aNumber = aValue / 2;
aNumber = aValue >> 1;
aNumber = aValue * 2;
aNumber = aValue << 1;
aNumber = aValue / 4;
aNumber = aValue >> 2;
aNumber = aValue * 8;
aNumber = aValue << 4;
// etc.
Whats is the "best" way to do operations? When is better to use bit shifting?