4.1.7. Macro ExpansionΒΆ
Within the code of ZLib, infback9.c has few macros. Let’s see an example of NEEDBITS.
#define NEEDBITS(n) \
do { \
while (bits < (unsigned)(n)) \
PULLBYTE(); \
} while (0)
But. the macro NEEDBITS depends on PULLBYTE
#define PULLBYTE() \
do { \
PULL(); \
have--; \
hold += (unsigned long)(*next++) << bits; \
bits += 8; \
} while (0)
The dependencies continue.
#define PULL() \
do { \
if (have == 0) { \
have = in(in_desc, &next); \
if (have == 0) { \
next = Z_NULL; \
ret = Z_BUF_ERROR; \
goto inf_leave; \
} \
} \
} while (0)
#define Z_NULL 0
#define Z_BUF_ERROR (-5)
Now. What does NEEDBITS(3) expand to?
Just hover cursor on the Macro. See the full expansion of the Macro.
If this is an information overflow, we can also see the expansion Step-by-Step. Press F2.
Press Right Arrow or Alt + Right to see step by step expansion.
Step 1/5:
Step 2/5:
Step 3/5:
And so on...
Buy eBook
