What is the meaning of the following pseudo-code?:

  1. BYTE1(v2) or BYTE1(v2)

  2. HIBYTE(v2)

Is there any explanation for those macros? How can I implement those macros in C code?


BYTE1(v2) is the second byte of value v2. according to the reference it's Zero-Indexed. defined as:

#define BYTEn(x, n)   (*((_BYTE*)&(x)+n))
#define BYTE1(x)   BYTEn(x,  1)         // byte 1 (counting from 0)

for example BYTE1(0x1213141516) is 0x15. (according to Little Endian Byte Order)

HIBYTE(v2) is the higher byte of value v2. defined as:

#define HIBYTE(x)   (*((_BYTE*)&(x)+1))

for example HIBYTE(0x1213) is 0x12. (according to Little Endian Byte Order)


Open your IDA installation folder open plugins\defs.h, this file contains all of the macros used by the hexrays decompiler. It can also be found at the github in arman's answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.