Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.



This topic is 6971 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hmmm, ahh I see :-P
so what is the limit for a DWORD, 8? right? or am I off again? :-)

Share this post

Link to post
Share on other sites
The limit for a DWORD would be 31: a DWORD is four bytes, so you can shift a bit 31 places to the left.

For setting a bit, I've seen /= being used. That should be ¦=, shouldn't it? Oops, I see that the board scripts convert ¦ to /...

If you do 1 OR x, with x being 1 or 0, you get 1 as the result. XOR (^ in C/C++) toggles a bit (1 -> 0, 0 -> 1).

Of course, you can also set multiple flags at once:

const int FLAG1 = 1 << 0;
const int FLAG2 = 1 << 1;
const int FLAG3 = 1 << 2;
const int FLAG4 = 1 << 3;
const int FLAG5 = 1 << 4;

int options = FLAG1 / FLAG2 / FLAG5;
(options would be 10011 = 0x13 = 19).

- options & FLAG3 == false
- options & FLAG5 == true


Edited by - Erik Post on 4/25/00 5:24:25 AM

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!