I was building this on Solaris and noticed the macros for PTR and V only
work for little-endian or gcc compilers. So I made a few changes, below
are the macros rewritten for more portability:
for huffquad
# if defined(__GNUC__) || (__SUNPRO_C >= 0x556)
# define PTR(offs, bits) { .ptr = { 0, bits, offs } }
# define V(v, w, x, y, hlen) { .value = { 1, hlen, v, w, x, y } }
#elif defined(WORDS_BIGENDIAN)
# define PTR(offs, bits) { { 0, bits, offs } }
# define V(v, w, x, y, hlen) { { 1, hlen, (v << 11) | (w << 10) | \
(x << 9) | (y << 8) } }
#else
# define PTR(offs, bits) { { 0, bits, offs } }
# define V(v, w, x, y, hlen) { { 1, hlen, (v << 0) | (w << 1) | \
(x << 2) | (y << 3) } }
# endif
for huffpair
# if defined(__GNUC__) || (__SUNPRO_C >= 0x556)
# define PTR(offs, bits) { .ptr= { 0, bits, offs } }
# define V(x, y, hlen) { .value= { 1, hlen, x, y } }
# elif defined(WORDS_BIGENDIAN)
# define PTR(offs, bits) { { 0, bits, offs } }
# define V(x, y, hlen) { { 1, hlen, (x << 8) | (y << 4) } }
# else
# define PTR(offs, bits) { { 0, bits, offs } }
# define V(x, y, hlen) { { 1, hlen, (x << 0) | (y << 4) } }
# endif
instead of the ptr: and value: it uses the C99 designator syntax, also
I've changed the shifts for big-endian.
obviously the WORDS_BIGENDIAN needs to come from the config.h.
regards,
Ian