Public Group

# high-order bit

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

## 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 on other sites
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 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 on other sites
Its the left-most bit (The MSB=Most Significant(sp?) Bit) representing
the highest value.

##### Share on other sites
Moved to For Beginners.

##### 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.

1. 1
2. 2
3. 3
Rutin
15
4. 4
khawk
13
5. 5
frob
12

• 9
• 9
• 11
• 11
• 23
• ### Forum Statistics

• Total Topics
633665
• Total Posts
3013245
×