WORD Type
Why is it called a WORD. And what do they mean by taking the LOWORD and HIWORD?
I always wanted to know.
A WORD typically means 2 bytes.
[EDITED]: LOWORD is a macro that extracts the lower two bytes of a 32-bit value (DWORD).
HIWORD is a macro that extracts the higher two bytes of a 32-bit value.
Example:
11111111 00000000 00000000 11111111
----(HIWORD)-----------(LOWORD)-----
Dire Wolf
direwolf@digitalfiends.com
EDIT: In a fit of delusion and tiredness, I made the mistake of saying that LOWORD and HIWORD represent the first and second byte of a WORD. Duh! My mistake, I wasn't paying attention when I typed the answer (hey it was a hard day).
SiCrane posted what I really meant (see below ) .
Edited by - Dire.Wolf on December 15, 2000 12:17:58 PM
[EDITED]: LOWORD is a macro that extracts the lower two bytes of a 32-bit value (DWORD).
HIWORD is a macro that extracts the higher two bytes of a 32-bit value.
Example:
11111111 00000000 00000000 11111111
----(HIWORD)-----------(LOWORD)-----
Dire Wolf
direwolf@digitalfiends.com
EDIT: In a fit of delusion and tiredness, I made the mistake of saying that LOWORD and HIWORD represent the first and second byte of a WORD. Duh! My mistake, I wasn't paying attention when I typed the answer (hey it was a hard day).
SiCrane posted what I really meant (see below ) .
Edited by - Dire.Wolf on December 15, 2000 12:17:58 PM
[email=direwolf@digitalfiends.com]Dire Wolf[/email]
www.digitalfiends.com
www.digitalfiends.com
WORD is a hold over from the days when the x86 had 16 bit register sizes. A word on a processor is typically the register width. Properly a word should now be considered 32 bits, after the 386 extended the registers, but for backwords compatibility reasons, it remains 16 bits.
LOWORD is a macro to extract the low-order word of a DWORD.
LOBYTE is a macro to extract the low-order byte of a WORD.
HIWORD is a macro to extract the high-order word of a DWORD.
HIBYTE is a macro to extract the high-order byte of a WORD.
So if you have the DWORD 0xdeadbeef, HIWORD(0xdeadbeef) would be 0xdead and LOWORD(0xdeadbeef) is 0xbeef. HIBYTE(0xbeef) would be 0xbe and LOBYTE(0xbeef) would be 0xef.
LOWORD is a macro to extract the low-order word of a DWORD.
LOBYTE is a macro to extract the low-order byte of a WORD.
HIWORD is a macro to extract the high-order word of a DWORD.
HIBYTE is a macro to extract the high-order byte of a WORD.
So if you have the DWORD 0xdeadbeef, HIWORD(0xdeadbeef) would be 0xdead and LOWORD(0xdeadbeef) is 0xbeef. HIBYTE(0xbeef) would be 0xbe and LOBYTE(0xbeef) would be 0xef.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement