Jump to content
  • Advertisement
Sign in to follow this  
3dcgmodeling

high-order bit

This topic is 4090 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

what does it mean? it from GetKeyboardState. "When the function returns, each member of the array pointed to by the lpKeyState parameter contains status data for a virtual key. If the high-order bit is 1, the key is down; otherwise, it is up." ----- here is link

Share this post


Link to post
Share on other sites
Advertisement
The high-order bit is the bit in the binary number which has the highest value. For example, in the binary number 1011, the 1 on the left has the highest value (of 2^3 or 8).

If you're not familiar with binary, I recommend this article. Note that finding the high-order bit might be tricky due to endianness.

Share this post


Link to post
Share on other sites
To get the high-order bit you need to use the logical and operator & on the high-bit, i.e., and it with 10000000 so that you get the highest bit. To represent 10000000 in C++ use hexadecimal, which in this case is 0x80

in conclusion: & 0x80

Share this post


Link to post
Share on other sites
if the data type is signed then the high-order bit will be 1 when the value is negative and 0 otherwise. You can do x<0 to test the bit.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!