I know you 'or' things together when using style masks and stuff, so how do you determine if a value has been 'or'ed into the resulting value.
Like:
so later on in the app, how do I determine that a contains 9?Code:long a;
a = 9 | 3;
:)
Printable View
I know you 'or' things together when using style masks and stuff, so how do you determine if a value has been 'or'ed into the resulting value.
Like:
so later on in the app, how do I determine that a contains 9?Code:long a;
a = 9 | 3;
:)
From what I can see - you can't.
The result of 9|3=11
That could have also come from
10|1
9|2
10|3
and that can keep on going. Now, you can technically figure out that this result contains a 9 by saying 11 & 9 - that would return 9 indicating that it does exist in this value, but you can't figure out if that was the actual number used to get 11.
That is why you use powers of two when setting flags... 1, 2, 4, 8, 16, 32, etc.
Z.
That makes sense. Thanks.Quote:
Originally posted by Zaei
That is why you use powers of two when setting flags... 1, 2, 4, 8, 16, 32, etc.
Z.
:)