C++ LOBYTE .Please explain more?

人盡茶涼 提交于 2021-01-27 05:23:27

问题


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++ ?


回答1:


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.



来源:https://stackoverflow.com/questions/18033192/c-lobyte-please-explain-more

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!