Go to the documentation of this file.
100 #undef CAREFUL_ALIGNMENT
105 #define CAREFUL_ALIGNMENT 0
108 #ifndef CAREFUL_ALIGNMENT
109 #define CAREFUL_ALIGNMENT 1
112 #define CVAL(buf, pos) ((unsigned) (((const unsigned char *) (buf))[pos]))
113 #define CVAL_NC(buf, pos) \
114 (((unsigned char *) (buf))[pos])
115 #define PVAL(buf, pos) (CVAL (buf, pos))
116 #define SCVAL(buf, pos, val) (CVAL_NC (buf, pos) = (val))
118 #if CAREFUL_ALIGNMENT
120 #define SVAL(buf, pos) (PVAL (buf, pos) | PVAL (buf, (pos) + 1) << 8)
121 #define IVAL(buf, pos) (SVAL (buf, pos) | SVAL (buf, (pos) + 2) << 16)
122 #define SSVALX(buf, pos, val) \
123 (CVAL_NC (buf, pos) = (unsigned char) ((val) &0xFF), \
124 CVAL_NC (buf, pos + 1) = (unsigned char) ((val) >> 8))
125 #define SIVALX(buf, pos, val) \
126 (SSVALX (buf, pos, val & 0xFFFF), SSVALX (buf, pos + 2, val >> 16))
127 #define SVALS(buf, pos) ((int16) SVAL (buf, pos))
128 #define IVALS(buf, pos) ((int32) IVAL (buf, pos))
129 #define SSVAL(buf, pos, val) SSVALX ((buf), (pos), ((uint16) (val)))
130 #define SIVAL(buf, pos, val) SIVALX ((buf), (pos), ((uint32) (val)))
131 #define SSVALS(buf, pos, val) SSVALX ((buf), (pos), ((int16) (val)))
132 #define SIVALS(buf, pos, val) SIVALX ((buf), (pos), ((int32) (val)))
144 #define SVAL(buf, pos) (*(const uint16 *) ((const char *) (buf) + (pos)))
145 #define SVAL_NC(buf, pos) \
146 (*(uint16 *) ((char *) (buf) + (pos)))
147 #define IVAL(buf, pos) (*(const uint32 *) ((const char *) (buf) + (pos)))
148 #define IVAL_NC(buf, pos) \
149 (*(uint32 *) ((char *) (buf) + (pos)))
150 #define SVALS(buf, pos) (*(const int16 *) ((const char *) (buf) + (pos)))
151 #define SVALS_NC(buf, pos) \
152 (*(int16 *) ((char *) (buf) + (pos)))
153 #define IVALS(buf, pos) (*(const int32 *) ((const char *) (buf) + (pos)))
154 #define IVALS_NC(buf, pos) \
155 (*(int32 *) ((char *) (buf) + (pos)))
158 #define SSVAL(buf, pos, val) SVAL_NC (buf, pos) = ((uint16) (val))
159 #define SIVAL(buf, pos, val) IVAL_NC (buf, pos) = ((uint32) (val))
160 #define SSVALS(buf, pos, val) SVALS_NC (buf, pos) = ((int16) (val))
161 #define SIVALS(buf, pos, val) IVALS_NC (buf, pos) = ((int32) (val))
166 #define SREV(x) ((((x) &0xFF) << 8) | (((x) >> 8) & 0xFF))
167 #define IREV(x) ((SREV (x) << 16) | (SREV ((x) >> 16)))
169 #define RSVAL(buf, pos) SREV (SVAL (buf, pos))
170 #define RSVALS(buf, pos) SREV (SVALS (buf, pos))
171 #define RIVAL(buf, pos) IREV (IVAL (buf, pos))
172 #define RIVALS(buf, pos) IREV (IVALS (buf, pos))
173 #define RSSVAL(buf, pos, val) SSVAL (buf, pos, SREV (val))
174 #define RSSVALS(buf, pos, val) SSVALS (buf, pos, SREV (val))
175 #define RSIVAL(buf, pos, val) SIVAL (buf, pos, IREV (val))
176 #define RSIVALS(buf, pos, val) SIVALS (buf, pos, IREV (val))
179 #define ALIGN4(p, base) ((p) + ((4 - (PTR_DIFF ((p), (base)) & 3)) & 3))
180 #define ALIGN2(p, base) ((p) + ((2 - (PTR_DIFF ((p), (base)) & 1)) & 1))