03-11-2010 05:44 PM
Solved! Go to Solution.
03-11-2010 06:05 PM - edited 03-11-2010 06:06 PM
AND the U32 with another U32 with the 3rd bit set to 1 (easy to do in binary formatting).
To set a bit, use the OR operator.
Boolean operators work very nice with integer numbers.
03-11-2010 06:05 PM
your int AND 4 (or change visual option of the '4' to binary and write '100')
03-11-2010 09:11 PM
Given: X is the input for bit 3 testing
1. X AND 8 = y (notice that at is 00000000000000000000000000001000 binary in decimal)
2. Convert y to a boolean array = z
3. Or all element in array(z) = result
If result is true, bit 3 is set. If not, bit 3 is clear.
Yik
03-12-2010 05:14 AM
03-12-2010 07:11 AM
Well explained Jim.
If you do a bit mask and the bit(s) you are looking for is set, then it does not matter what the answer is, it will not be zero. So result != 0 means the bit was set. 🙂
03-12-2010 10:29 AM
Thanks to all for the great answers! My first reading of the LV Help for AND led me to think it was only boolean, not bitwise.