Hi All,
I'm not that expert at C but I'm trying to understand some code that
does extensive use of the following two preprocessor macros:
#define WORD(ptr) (((*(octet *)(ptr))<<8)|(* (octet *)((ptr)+1)))
#define DWORD(ptr) (((*(octet *)(ptr))<<24)|( *(octet *)((ptr)+1)<<16 )|\
(*(octet *)((ptr)+2)<<8) |(*(octet *)((ptr)+3)))
I'm lost with all that shifting and indirection :-(
Could some kind soul explain what these macros are doing?
TIA,
David
I'm not that expert at C but I'm trying to understand some code that
does extensive use of the following two preprocessor macros:
#define WORD(ptr) (((*(octet *)(ptr))<<8)|(* (octet *)((ptr)+1)))
#define DWORD(ptr) (((*(octet *)(ptr))<<24)|( *(octet *)((ptr)+1)<<16 )|\
(*(octet *)((ptr)+2)<<8) |(*(octet *)((ptr)+3)))
I'm lost with all that shifting and indirection :-(
Could some kind soul explain what these macros are doing?
TIA,
David
Comment