Raised This Month: $ Target: $400
 0% 

Menu thing


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
MistaGee
Senior Member
Join Date: Aug 2004
Location: Germany (Fulda)
Old 03-03-2005 , 09:18  
Reply With Quote #4

btw: the author of the linked tutorial didn't tell us why you can also use
Code:
new keys = 1023
instead of
Code:
new keys=(1<<0|1<<1|1<<2|1<<3|..|1<<9)
Well this is quite easy:

With the above code you set bits. Written side by side, this looks as following:
Code:
Keys: 9 8 7 6 5 4 3 2 1 0
Bits: 1 1 1 1 1 1 1 1 1 1
This way makes clear that these bits represent a binary number, which, "translated" into the decimal system, is equal to 1023.

Let's see what happens if u only need keys 0-4:
Code:
Keys: 9 8 7 6 5 4 3 2 1 0
Bits: 0 0 0 0 0 1 1 1 1 1
The corresponding decimal value for this would be 31.

I think it's a lot easier using the bitwise notation cuz u won't lose the overview there, just wanted to give a hint...
__________________
Ich hab nie behauptet dass ich kein Genie bin!
Mumble-Django: A web interface for Mumble
MistaGee is offline
Send a message via ICQ to MistaGee
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:16.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode