Code: Select all
MakeWord(2,2)
Code: Select all
MakeWord(2,2)
Code: Select all
MAKEWORD(a, b) ((WORD)(((BYTE)((DWORD_PTR)(a) & 0xff)) | WORD)((BYTE)((DWORD_PTR)(b) & 0xff))) << 8))
Code: Select all
Procedure.w MakeWord(a.b,b.b)
c.w=(b & $ff)|((a & $ff)<<8)
ProcedureReturn c
EndProcedure
Debug(Hex(MakeWord(1,1)))
The current definition is a little more elaborated, but the meaning is still the same.The MAKEWORD macro creates an unsigned 16-bit integer by concatenating two given unsigned character values.
WORD MAKEWORD(
BYTE bLow, // low-order byte of short value
BYTE bHigh // high-order byte of short value
);
Parameters
bLow Specifies the low-order byte of the new short value.
bHigh Specifies the high-order byte of the new short value.
Return Values:
The return value is an unsigned 16-bit integer value.
Remarks
The MAKEWORD macro is defined as follows:
#define MAKEWORD(a, b) \
((WORD) (((BYTE) (a)) | ((WORD) ((BYTE) (b))) << 8))
Code: Select all
Procedure.w MakeWord(a.b,b.b)
c.w=(b & $ff)|((a & $ff)<<8)
ProcedureReturn c
EndProcedure
Debug(Hex(MakeWord(1,2)))
Code: Select all
Procedure.w MakeWord(a.b,b.b)
c.w=(a & $ff)|((b & $ff)<<8)
ProcedureReturn c
EndProcedure
Debug(Hex(MakeWord(1,2)))
Code: Select all
c.w=(a & $ff)|((b & $ff)<<8)=0901
Code: Select all
c.w=(b & $ff)|((a & $ff)<<8)=0109