What is the difference between bit shifting and arithmetical operations?
Posted
by Espuz
on Stack Overflow
See other posts from Stack Overflow
or by Espuz
Published on 2010-06-07T07:30:53Z
Indexed on
2010/06/07
7:32 UTC
Read the original article
Hit count: 167
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?
© Stack Overflow or respective owner