M
Morten Wennevik
Hi Frazer,
You are confusing | (OR) with & (AND)
& will set bits to 1 if both bits are 1, otherwise it will be 0
1 will set bits to 1 if one or both of the bits are 1, otherwise 0
100 (4)
&
001 (1)
____
000 (0)
-----------------------------
100 (4)
|
001 (1)
____
101 (5)
Happy coding!
Morten Wennevik [C# MVP]
You are confusing | (OR) with & (AND)
& will set bits to 1 if both bits are 1, otherwise it will be 0
1 will set bits to 1 if one or both of the bits are 1, otherwise 0
100 (4)
&
001 (1)
____
000 (0)
-----------------------------
100 (4)
|
001 (1)
____
101 (5)
Happy coding!
Morten Wennevik [C# MVP]