Your guide to Bit Manipulation. I though it may look easy ...Explore further
2018-6-4u2002·u2002BIT TRICKS. Check if a given number is even? if the least bit is 0, this can be done by using the bit-wise AND (x & 1 ) == 0 0110 (6) & 0001 = 0000 TRUE. Check if the number is a power of 2? a number that is a power of two, should only have one 1 set; if we subtract 1, all the zeros following will be set to one. If we & that with the original ...
Get Price