Write a macro to find the bit value in a given 16 bit variable at a given location.
BITVALUE(var,n)
Example: 0x1234
find the bit value of 3rd bit. 4 = 0100(base 2)
answer = 0
find the bit value of 2nd bit. 4 = 0100(base 2)
answer = 1
find the bit value of 5th bit. 34 = 0011-0100(base 2)
answer = 1
--
At a certain point there is no difference between Magic and Science.
-Bhimsen Joshi
No comments:
Post a Comment