What method would you use to determine if the the bit that represents 2^x is a 1 or 0 ?
You can also use
bool isSet = ((value>>x) & 1) != 0;
EDIT: the difference between "(value>>x) & 1
" and "value & (1<
In that particular case, with "(value>>x) & 1
" you will have the sign of value, whereas you get a 0 with "value & (1<
If you prefer to have a 0 in that case, you can use the ">>>
" operator, instead if ">>
"
So, "((value>>>x) & 1) != 0
" and "(value & (1<