|
-
Mar 16th, 2002, 06:07 PM
#1
Quick question about bitwise operators...
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?
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 16th, 2002, 09:09 PM
#2
Lively Member
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.
-
Mar 16th, 2002, 10:16 PM
#3
That is why you use powers of two when setting flags... 1, 2, 4, 8, 16, 32, etc.
Z.
-
Mar 16th, 2002, 10:19 PM
#4
Originally posted by Zaei
That is why you use powers of two when setting flags... 1, 2, 4, 8, 16, 32, etc.
Z.
That makes sense. Thanks.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|