Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ LOBYTE .Please explain more?

Tags:

c++

byte

i recently started learning c++ and assembly and i came across LOBYTE when i disassembled something in IDA and viewed the function in pseudo code.

Reading the msdn : http://msdn.microsoft.com/en-us/library/windows/desktop/ms632658(v=vs.85).aspx

i still dont understand.What is a low order byte? Can someone tell me more on what its used for and an example of its usage in c++ ?

like image 426
Imaginarys Avatar asked Aug 03 '13 13:08

Imaginarys


1 Answers

LOBYTE and HIBYTE along with HIWORD and LOWORD, are macros used to extract a word or a byte from a larger set of bytes/words.

As an example, say you have the two bytes 24 FF, which make a word. You have this value stored in a unsigned short ushortvar in your program. Now you can extract either of the two bytes by using HIBYTE(ushortvar) or LOBYTE(ushortvar). The first will be equal to 0x24, and the latter will be equal to 0xff. You can do the same with a unsigned int to extract a one of the words by using LOWORD respectively HIWORD.

like image 147
Jocke Avatar answered Sep 24 '22 01:09

Jocke