Solved! Go to Solution.
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.
your int AND 4 (or change visual option of the '4' to binary and write '100')
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
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. ![]()
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.