Revision 4a051891 libavutil/intreadwrite.h
libavutil/intreadwrite.h | ||
---|---|---|
55 | 55 |
# define AV_WN16(p, v) AV_WB16(p, v) |
56 | 56 |
# endif |
57 | 57 |
|
58 |
# if defined(AV_RN32) && !defined(AV_RB32) |
|
59 |
# define AV_RB32(p) AV_RN32(p) |
|
60 |
# elif !defined(AV_RN32) && defined(AV_RB32) |
|
61 |
# define AV_RN32(p) AV_RB32(p) |
|
62 |
# endif |
|
63 |
|
|
64 | 58 |
# if defined(AV_RN24) && !defined(AV_RB24) |
65 | 59 |
# define AV_RB24(p) AV_RN24(p) |
66 | 60 |
# elif !defined(AV_RN24) && defined(AV_RB24) |
... | ... | |
73 | 67 |
# define AV_WN24(p, v) AV_WB24(p, v) |
74 | 68 |
# endif |
75 | 69 |
|
70 |
# if defined(AV_RN32) && !defined(AV_RB32) |
|
71 |
# define AV_RB32(p) AV_RN32(p) |
|
72 |
# elif !defined(AV_RN32) && defined(AV_RB32) |
|
73 |
# define AV_RN32(p) AV_RB32(p) |
|
74 |
# endif |
|
75 |
|
|
76 | 76 |
# if defined(AV_WN32) && !defined(AV_WB32) |
77 | 77 |
# define AV_WB32(p, v) AV_WN32(p, v) |
78 | 78 |
# elif !defined(AV_WN32) && defined(AV_WB32) |
... | ... | |
105 | 105 |
# define AV_WN16(p, v) AV_WL16(p, v) |
106 | 106 |
# endif |
107 | 107 |
|
108 |
# if defined(AV_RN32) && !defined(AV_RL32) |
|
109 |
# define AV_RL32(p) AV_RN32(p) |
|
110 |
# elif !defined(AV_RN32) && defined(AV_RL32) |
|
111 |
# define AV_RN32(p) AV_RL32(p) |
|
112 |
# endif |
|
113 |
|
|
114 | 108 |
# if defined(AV_RN24) && !defined(AV_RL24) |
115 | 109 |
# define AV_RL24(p) AV_RN24(p) |
116 | 110 |
# elif !defined(AV_RN24) && defined(AV_RL24) |
... | ... | |
123 | 117 |
# define AV_WN24(p, v) AV_WL24(p, v) |
124 | 118 |
# endif |
125 | 119 |
|
120 |
# if defined(AV_RN32) && !defined(AV_RL32) |
|
121 |
# define AV_RL32(p) AV_RN32(p) |
|
122 |
# elif !defined(AV_RN32) && defined(AV_RL32) |
|
123 |
# define AV_RN32(p) AV_RL32(p) |
|
124 |
# endif |
|
125 |
|
|
126 | 126 |
# if defined(AV_WN32) && !defined(AV_WL32) |
127 | 127 |
# define AV_WL32(p, v) AV_WN32(p, v) |
128 | 128 |
# elif !defined(AV_WN32) && defined(AV_WL32) |
... | ... | |
170 | 170 |
#else |
171 | 171 |
|
172 | 172 |
#ifndef AV_RB16 |
173 |
#define AV_RB16(x) ((((const uint8_t*)(x))[0] << 8) | \ |
|
174 |
((const uint8_t*)(x))[1]) |
|
173 |
# define AV_RB16(x) \ |
|
174 |
((((const uint8_t*)(x))[0] << 8) | \ |
|
175 |
((const uint8_t*)(x))[1]) |
|
175 | 176 |
#endif |
176 | 177 |
#ifndef AV_WB16 |
177 |
#define AV_WB16(p, d) do { \ |
|
178 |
((uint8_t*)(p))[1] = (d); \ |
|
179 |
((uint8_t*)(p))[0] = (d)>>8; } while(0) |
|
178 |
# define AV_WB16(p, d) do { \ |
|
179 |
((uint8_t*)(p))[1] = (d); \ |
|
180 |
((uint8_t*)(p))[0] = (d)>>8; \ |
|
181 |
} while(0) |
|
180 | 182 |
#endif |
181 | 183 |
|
182 | 184 |
#ifndef AV_RL16 |
183 |
#define AV_RL16(x) ((((const uint8_t*)(x))[1] << 8) | \ |
|
184 |
((const uint8_t*)(x))[0]) |
|
185 |
# define AV_RL16(x) \ |
|
186 |
((((const uint8_t*)(x))[1] << 8) | \ |
|
187 |
((const uint8_t*)(x))[0]) |
|
185 | 188 |
#endif |
186 | 189 |
#ifndef AV_WL16 |
187 |
#define AV_WL16(p, d) do { \ |
|
188 |
((uint8_t*)(p))[0] = (d); \ |
|
189 |
((uint8_t*)(p))[1] = (d)>>8; } while(0) |
|
190 |
# define AV_WL16(p, d) do { \ |
|
191 |
((uint8_t*)(p))[0] = (d); \ |
|
192 |
((uint8_t*)(p))[1] = (d)>>8; \ |
|
193 |
} while(0) |
|
190 | 194 |
#endif |
191 | 195 |
|
192 | 196 |
#ifndef AV_RB32 |
193 |
#define AV_RB32(x) ((((const uint8_t*)(x))[0] << 24) | \ |
|
194 |
(((const uint8_t*)(x))[1] << 16) | \ |
|
195 |
(((const uint8_t*)(x))[2] << 8) | \ |
|
196 |
((const uint8_t*)(x))[3]) |
|
197 |
# define AV_RB32(x) \ |
|
198 |
((((const uint8_t*)(x))[0] << 24) | \ |
|
199 |
(((const uint8_t*)(x))[1] << 16) | \ |
|
200 |
(((const uint8_t*)(x))[2] << 8) | \ |
|
201 |
((const uint8_t*)(x))[3]) |
|
197 | 202 |
#endif |
198 | 203 |
#ifndef AV_WB32 |
199 |
#define AV_WB32(p, d) do { \ |
|
200 |
((uint8_t*)(p))[3] = (d); \ |
|
201 |
((uint8_t*)(p))[2] = (d)>>8; \ |
|
202 |
((uint8_t*)(p))[1] = (d)>>16; \ |
|
203 |
((uint8_t*)(p))[0] = (d)>>24; } while(0) |
|
204 |
# define AV_WB32(p, d) do { \ |
|
205 |
((uint8_t*)(p))[3] = (d); \ |
|
206 |
((uint8_t*)(p))[2] = (d)>>8; \ |
|
207 |
((uint8_t*)(p))[1] = (d)>>16; \ |
|
208 |
((uint8_t*)(p))[0] = (d)>>24; \ |
|
209 |
} while(0) |
|
204 | 210 |
#endif |
205 | 211 |
|
206 | 212 |
#ifndef AV_RL32 |
207 |
#define AV_RL32(x) ((((const uint8_t*)(x))[3] << 24) | \ |
|
208 |
(((const uint8_t*)(x))[2] << 16) | \ |
|
209 |
(((const uint8_t*)(x))[1] << 8) | \ |
|
210 |
((const uint8_t*)(x))[0]) |
|
213 |
# define AV_RL32(x) \ |
|
214 |
((((const uint8_t*)(x))[3] << 24) | \ |
|
215 |
(((const uint8_t*)(x))[2] << 16) | \ |
|
216 |
(((const uint8_t*)(x))[1] << 8) | \ |
|
217 |
((const uint8_t*)(x))[0]) |
|
211 | 218 |
#endif |
212 | 219 |
#ifndef AV_WL32 |
213 |
#define AV_WL32(p, d) do { \ |
|
214 |
((uint8_t*)(p))[0] = (d); \ |
|
215 |
((uint8_t*)(p))[1] = (d)>>8; \ |
|
216 |
((uint8_t*)(p))[2] = (d)>>16; \ |
|
217 |
((uint8_t*)(p))[3] = (d)>>24; } while(0) |
|
220 |
# define AV_WL32(p, d) do { \ |
|
221 |
((uint8_t*)(p))[0] = (d); \ |
|
222 |
((uint8_t*)(p))[1] = (d)>>8; \ |
|
223 |
((uint8_t*)(p))[2] = (d)>>16; \ |
|
224 |
((uint8_t*)(p))[3] = (d)>>24; \ |
|
225 |
} while(0) |
|
218 | 226 |
#endif |
219 | 227 |
|
220 | 228 |
#ifndef AV_RB64 |
221 |
#define AV_RB64(x) (((uint64_t)((const uint8_t*)(x))[0] << 56) | \ |
|
222 |
((uint64_t)((const uint8_t*)(x))[1] << 48) | \ |
|
223 |
((uint64_t)((const uint8_t*)(x))[2] << 40) | \ |
|
224 |
((uint64_t)((const uint8_t*)(x))[3] << 32) | \ |
|
225 |
((uint64_t)((const uint8_t*)(x))[4] << 24) | \ |
|
226 |
((uint64_t)((const uint8_t*)(x))[5] << 16) | \ |
|
227 |
((uint64_t)((const uint8_t*)(x))[6] << 8) | \ |
|
228 |
(uint64_t)((const uint8_t*)(x))[7]) |
|
229 |
# define AV_RB64(x) \ |
|
230 |
(((uint64_t)((const uint8_t*)(x))[0] << 56) | \ |
|
231 |
((uint64_t)((const uint8_t*)(x))[1] << 48) | \ |
|
232 |
((uint64_t)((const uint8_t*)(x))[2] << 40) | \ |
|
233 |
((uint64_t)((const uint8_t*)(x))[3] << 32) | \ |
|
234 |
((uint64_t)((const uint8_t*)(x))[4] << 24) | \ |
|
235 |
((uint64_t)((const uint8_t*)(x))[5] << 16) | \ |
|
236 |
((uint64_t)((const uint8_t*)(x))[6] << 8) | \ |
|
237 |
(uint64_t)((const uint8_t*)(x))[7]) |
|
229 | 238 |
#endif |
230 | 239 |
#ifndef AV_WB64 |
231 |
#define AV_WB64(p, d) do { \ |
|
232 |
((uint8_t*)(p))[7] = (d); \ |
|
233 |
((uint8_t*)(p))[6] = (d)>>8; \ |
|
234 |
((uint8_t*)(p))[5] = (d)>>16; \ |
|
235 |
((uint8_t*)(p))[4] = (d)>>24; \ |
|
236 |
((uint8_t*)(p))[3] = (d)>>32; \ |
|
237 |
((uint8_t*)(p))[2] = (d)>>40; \ |
|
238 |
((uint8_t*)(p))[1] = (d)>>48; \ |
|
239 |
((uint8_t*)(p))[0] = (d)>>56; } while(0) |
|
240 |
# define AV_WB64(p, d) do { \ |
|
241 |
((uint8_t*)(p))[7] = (d); \ |
|
242 |
((uint8_t*)(p))[6] = (d)>>8; \ |
|
243 |
((uint8_t*)(p))[5] = (d)>>16; \ |
|
244 |
((uint8_t*)(p))[4] = (d)>>24; \ |
|
245 |
((uint8_t*)(p))[3] = (d)>>32; \ |
|
246 |
((uint8_t*)(p))[2] = (d)>>40; \ |
|
247 |
((uint8_t*)(p))[1] = (d)>>48; \ |
|
248 |
((uint8_t*)(p))[0] = (d)>>56; \ |
|
249 |
} while(0) |
|
240 | 250 |
#endif |
241 | 251 |
|
242 | 252 |
#ifndef AV_RL64 |
243 |
#define AV_RL64(x) (((uint64_t)((const uint8_t*)(x))[7] << 56) | \ |
|
244 |
((uint64_t)((const uint8_t*)(x))[6] << 48) | \ |
|
245 |
((uint64_t)((const uint8_t*)(x))[5] << 40) | \ |
|
246 |
((uint64_t)((const uint8_t*)(x))[4] << 32) | \ |
|
247 |
((uint64_t)((const uint8_t*)(x))[3] << 24) | \ |
|
248 |
((uint64_t)((const uint8_t*)(x))[2] << 16) | \ |
|
249 |
((uint64_t)((const uint8_t*)(x))[1] << 8) | \ |
|
250 |
(uint64_t)((const uint8_t*)(x))[0]) |
|
253 |
# define AV_RL64(x) \ |
|
254 |
(((uint64_t)((const uint8_t*)(x))[7] << 56) | \ |
|
255 |
((uint64_t)((const uint8_t*)(x))[6] << 48) | \ |
|
256 |
((uint64_t)((const uint8_t*)(x))[5] << 40) | \ |
|
257 |
((uint64_t)((const uint8_t*)(x))[4] << 32) | \ |
|
258 |
((uint64_t)((const uint8_t*)(x))[3] << 24) | \ |
|
259 |
((uint64_t)((const uint8_t*)(x))[2] << 16) | \ |
|
260 |
((uint64_t)((const uint8_t*)(x))[1] << 8) | \ |
|
261 |
(uint64_t)((const uint8_t*)(x))[0]) |
|
251 | 262 |
#endif |
252 | 263 |
#ifndef AV_WL64 |
253 |
#define AV_WL64(p, d) do { \ |
|
254 |
((uint8_t*)(p))[0] = (d); \ |
|
255 |
((uint8_t*)(p))[1] = (d)>>8; \ |
|
256 |
((uint8_t*)(p))[2] = (d)>>16; \ |
|
257 |
((uint8_t*)(p))[3] = (d)>>24; \ |
|
258 |
((uint8_t*)(p))[4] = (d)>>32; \ |
|
259 |
((uint8_t*)(p))[5] = (d)>>40; \ |
|
260 |
((uint8_t*)(p))[6] = (d)>>48; \ |
|
261 |
((uint8_t*)(p))[7] = (d)>>56; } while(0) |
|
264 |
# define AV_WL64(p, d) do { \ |
|
265 |
((uint8_t*)(p))[0] = (d); \ |
|
266 |
((uint8_t*)(p))[1] = (d)>>8; \ |
|
267 |
((uint8_t*)(p))[2] = (d)>>16; \ |
|
268 |
((uint8_t*)(p))[3] = (d)>>24; \ |
|
269 |
((uint8_t*)(p))[4] = (d)>>32; \ |
|
270 |
((uint8_t*)(p))[5] = (d)>>40; \ |
|
271 |
((uint8_t*)(p))[6] = (d)>>48; \ |
|
272 |
((uint8_t*)(p))[7] = (d)>>56; \ |
|
273 |
} while(0) |
|
262 | 274 |
#endif |
263 | 275 |
|
264 | 276 |
#if HAVE_BIGENDIAN |
... | ... | |
356 | 368 |
#endif |
357 | 369 |
|
358 | 370 |
#ifndef AV_RB24 |
359 |
#define AV_RB24(x) ((((const uint8_t*)(x))[0] << 16) | \ |
|
360 |
(((const uint8_t*)(x))[1] << 8) | \ |
|
361 |
((const uint8_t*)(x))[2]) |
|
371 |
# define AV_RB24(x) \ |
|
372 |
((((const uint8_t*)(x))[0] << 16) | \ |
|
373 |
(((const uint8_t*)(x))[1] << 8) | \ |
|
374 |
((const uint8_t*)(x))[2]) |
|
362 | 375 |
#endif |
363 | 376 |
#ifndef AV_WB24 |
364 |
#define AV_WB24(p, d) do { \ |
|
365 |
((uint8_t*)(p))[2] = (d); \ |
|
366 |
((uint8_t*)(p))[1] = (d)>>8; \ |
|
367 |
((uint8_t*)(p))[0] = (d)>>16; } while(0) |
|
377 |
# define AV_WB24(p, d) do { \ |
|
378 |
((uint8_t*)(p))[2] = (d); \ |
|
379 |
((uint8_t*)(p))[1] = (d)>>8; \ |
|
380 |
((uint8_t*)(p))[0] = (d)>>16; \ |
|
381 |
} while(0) |
|
368 | 382 |
#endif |
369 | 383 |
|
370 | 384 |
#ifndef AV_RL24 |
371 |
#define AV_RL24(x) ((((const uint8_t*)(x))[2] << 16) | \ |
|
372 |
(((const uint8_t*)(x))[1] << 8) | \ |
|
373 |
((const uint8_t*)(x))[0]) |
|
385 |
# define AV_RL24(x) \ |
|
386 |
((((const uint8_t*)(x))[2] << 16) | \ |
|
387 |
(((const uint8_t*)(x))[1] << 8) | \ |
|
388 |
((const uint8_t*)(x))[0]) |
|
374 | 389 |
#endif |
375 | 390 |
#ifndef AV_WL24 |
376 |
#define AV_WL24(p, d) do { \ |
|
377 |
((uint8_t*)(p))[0] = (d); \ |
|
378 |
((uint8_t*)(p))[1] = (d)>>8; \ |
|
379 |
((uint8_t*)(p))[2] = (d)>>16; } while(0) |
|
391 |
# define AV_WL24(p, d) do { \ |
|
392 |
((uint8_t*)(p))[0] = (d); \ |
|
393 |
((uint8_t*)(p))[1] = (d)>>8; \ |
|
394 |
((uint8_t*)(p))[2] = (d)>>16; \ |
|
395 |
} while(0) |
|
380 | 396 |
#endif |
381 | 397 |
|
382 | 398 |
#endif /* AVUTIL_INTREADWRITE_H */ |
Also available in: Unified diff