Go to the documentation of this file.
108 #undef CAREFUL_ALIGNMENT
113 #define CAREFUL_ALIGNMENT 0
116 #ifndef CAREFUL_ALIGNMENT
117 #define CAREFUL_ALIGNMENT 1
120 #define CVAL(buf,pos) ((unsigned)(((const unsigned char *)(buf))[pos]))
121 #define CVAL_NC(buf,pos) (((unsigned char *)(buf))[pos])
122 #define PVAL(buf,pos) (CVAL(buf,pos))
123 #define SCVAL(buf,pos,val) (CVAL_NC(buf,pos) = (val))
126 #if CAREFUL_ALIGNMENT
128 #define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8)
129 #define IVAL(buf,pos) (SVAL(buf,pos)|SVAL(buf,(pos)+2)<<16)
130 #define SSVALX(buf,pos,val) (CVAL_NC(buf,pos)=(unsigned char)((val)&0xFF),CVAL_NC(buf,pos+1)=(unsigned char)((val)>>8))
131 #define SIVALX(buf,pos,val) (SSVALX(buf,pos,val&0xFFFF),SSVALX(buf,pos+2,val>>16))
132 #define SVALS(buf,pos) ((int16_t)SVAL(buf,pos))
133 #define IVALS(buf,pos) ((int32_t)IVAL(buf,pos))
134 #define SSVAL(buf,pos,val) SSVALX((buf),(pos),((uint16_t)(val)))
135 #define SIVAL(buf,pos,val) SIVALX((buf),(pos),((uint32_t)(val)))
136 #define SSVALS(buf,pos,val) SSVALX((buf),(pos),((int16_t)(val)))
137 #define SIVALS(buf,pos,val) SIVALX((buf),(pos),((int32_t)(val)))
149 #define SVAL(buf,pos) (*(const uint16_t *)((const char *)(buf) + (pos)))
150 #define SVAL_NC(buf,pos) (*(uint16_t *)((char *)(buf) + (pos)))
151 #define IVAL(buf,pos) (*(const uint32_t *)((const char *)(buf) + (pos)))
152 #define IVAL_NC(buf,pos) (*(uint32_t *)((char *)(buf) + (pos)))
153 #define SVALS(buf,pos) (*(const int16_t *)((const char *)(buf) + (pos)))
154 #define SVALS_NC(buf,pos) (*(int16_t *)((char *)(buf) + (pos)))
155 #define IVALS(buf,pos) (*(const int32_t *)((const char *)(buf) + (pos)))
156 #define IVALS_NC(buf,pos) (*(int32_t *)((char *)(buf) + (pos)))
159 #define SSVAL(buf,pos,val) SVAL_NC(buf,pos)=((uint16_t)(val))
160 #define SIVAL(buf,pos,val) IVAL_NC(buf,pos)=((uint32_t)(val))
161 #define SSVALS(buf,pos,val) SVALS_NC(buf,pos)=((int16_t)(val))
162 #define SIVALS(buf,pos,val) IVALS_NC(buf,pos)=((int32_t)(val))
167 #define SREV(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF))
168 #define IREV(x) ((SREV(x)<<16) | (SREV((x)>>16)))
170 #define RSVAL(buf,pos) SREV(SVAL(buf,pos))
171 #define RSVALS(buf,pos) SREV(SVALS(buf,pos))
172 #define RIVAL(buf,pos) IREV(IVAL(buf,pos))
173 #define RIVALS(buf,pos) IREV(IVALS(buf,pos))
174 #define RSSVAL(buf,pos,val) SSVAL(buf,pos,SREV(val))
175 #define RSSVALS(buf,pos,val) SSVALS(buf,pos,SREV(val))
176 #define RSIVAL(buf,pos,val) SIVAL(buf,pos,IREV(val))
177 #define RSIVALS(buf,pos,val) SIVALS(buf,pos,IREV(val))
180 #define ALIGN4(p,base) ((p) + ((4 - (PTR_DIFF((p), (base)) & 3)) & 3))
181 #define ALIGN2(p,base) ((p) + ((2 - (PTR_DIFF((p), (base)) & 1)) & 1))