Hey,I am trying to retrieve the first three bits of a number. The code that I am using should work but it isn't giving me the correct result when trying certain numbers. Below is the code I am using:
1 2 3 4
unsignedshort num1, num2 = 0;
unsignedshort num = 65535// binary 111111111111111
num1 = num && 0x07;// gives me 1 but should give 7(111)
num2 = num >>3;//gives me 8191, which is correct
Can anyone tell me why I am not getting the first three correct bits(111)?
Thanks In Advance