39#define s_push_layer(s,h,n) { (s)->h = (s)->p; (s)->p += n; }
40#define s_pop_layer(s,h) (s)->p = (s)->h;
41#define s_mark_end(s) (s)->end = (s)->p;
42#define s_check(s) ((s)->p <= (s)->end)
43#define s_check_rem(s,n) ((s)->p + n <= (s)->end)
44#define s_check_end(s) ((s)->p == (s)->end)
45#define s_length(s) ((s)->end - (s)->data)
46#define s_reset(s) ((s)->end = (s)->p = (s)->data)
48#if defined(L_ENDIAN) && !defined(NEED_ALIGN)
49#define in_uint16_le(s,v) { v = *(uint16 *)((s)->p); (s)->p += 2; }
50#define in_uint32_le(s,v) { v = *(uint32 *)((s)->p); (s)->p += 4; }
51#define out_uint16_le(s,v) { *(uint16 *)((s)->p) = v; (s)->p += 2; }
52#define out_uint32_le(s,v) { *(uint32 *)((s)->p) = v; (s)->p += 4; }
55#define in_uint16_le(s,v) { v = *((s)->p++); v += *((s)->p++) << 8; }
56#define in_uint32_le(s,v) { in_uint16_le(s,v) \
57 v += *((s)->p++) << 16; v += *((s)->p++) << 24; }
58#define out_uint16_le(s,v) { *((s)->p++) = (v) & 0xff; *((s)->p++) = ((v) >> 8) & 0xff; }
59#define out_uint32_le(s,v) { out_uint16_le(s, (v) & 0xffff); out_uint16_le(s, ((v) >> 16) & 0xffff); }
62#if defined(B_ENDIAN) && !defined(NEED_ALIGN)
63#define in_uint16_be(s,v) { v = *(uint16 *)((s)->p); (s)->p += 2; }
64#define in_uint32_be(s,v) { v = *(uint32 *)((s)->p); (s)->p += 4; }
65#define out_uint16_be(s,v) { *(uint16 *)((s)->p) = v; (s)->p += 2; }
66#define out_uint32_be(s,v) { *(uint32 *)((s)->p) = v; (s)->p += 4; }
68#define B_ENDIAN_PREFERRED
69#define in_uint16(s,v) in_uint16_be(s,v)
70#define in_uint32(s,v) in_uint32_be(s,v)
71#define out_uint16(s,v) out_uint16_be(s,v)
72#define out_uint32(s,v) out_uint32_be(s,v)
75#define in_uint16_be(s,v) { v = *((s)->p++); next_be(s,v); }
76#define in_uint32_be(s,v) { in_uint16_be(s,v); next_be(s,v); next_be(s,v); }
77#define out_uint16_be(s,v) { *((s)->p++) = ((v) >> 8) & 0xff; *((s)->p++) = (v) & 0xff; }
78#define out_uint32_be(s,v) { out_uint16_be(s, ((v) >> 16) & 0xffff); out_uint16_be(s, (v) & 0xffff); }
81#ifndef B_ENDIAN_PREFERRED
82#define in_uint16(s,v) in_uint16_le(s,v)
83#define in_uint32(s,v) in_uint32_le(s,v)
84#define out_uint16(s,v) out_uint16_le(s,v)
85#define out_uint32(s,v) out_uint32_le(s,v)
88#define in_uint8(s,v) v = *((s)->p++);
89#define in_uint8p(s,v,n) { v = (s)->p; (s)->p += n; }
90#define in_uint8a(s,v,n) { memcpy(v,(s)->p,n); (s)->p += n; }
91#define in_uint8s(s,n) (s)->p += n;
92#define out_uint8(s,v) *((s)->p++) = v;
93#define out_uint8p(s,v,n) { memcpy((s)->p,v,n); (s)->p += n; }
94#define out_uint8a(s,v,n) out_uint8p(s,v,n);
95#define out_uint8s(s,n) { memset((s)->p,0,n); (s)->p += n; }
97#define next_be(s,v) v = ((v) << 8) + *((s)->p++);
unsigned char * channel_hdr