22 #ifndef COMMON_ENDIAN_H 23 #define COMMON_ENDIAN_H 25 #include "common/scummsys.h" 52 #if !defined(SCUMM_LITTLE_ENDIAN) && !defined(SCUMM_BIG_ENDIAN) 53 # error No endianness defined 60 #define SWAP_CONSTANT_64(a) \ 61 ((uint64)((((a) >> 56) & 0x000000FF) | \ 62 (((a) >> 40) & 0x0000FF00) | \ 63 (((a) >> 24) & 0x00FF0000) | \ 64 (((a) >> 8) & 0xFF000000) | \ 65 (((a) & 0xFF000000) << 8) | \ 66 (((a) & 0x00FF0000) << 24) | \ 67 (((a) & 0x0000FF00) << 40) | \ 68 (((a) & 0x000000FF) << 56) )) 74 #define SWAP_CONSTANT_32(a) \ 75 ((uint32)((((a) >> 24) & 0x00FF) | \ 76 (((a) >> 8) & 0xFF00) | \ 77 (((a) & 0xFF00) << 8) | \ 78 (((a) & 0x00FF) << 24) )) 84 #define SWAP_CONSTANT_16(a) \ 85 ((uint16)((((a) >> 8) & 0x00FF) | \ 86 (((a) << 8) & 0xFF00) )) 96 #if GCC_ATLEAST(4, 8) || defined(__clang__) 99 return __builtin_bswap16(a);
102 #elif defined(_MSC_VER) 105 return _byteswap_ushort(a);
111 return (a >> 8) | (a << 8);
123 #if defined(__GNUC__) 126 return __builtin_bswap32(a);
129 #elif defined(_MSC_VER) 132 return _byteswap_ulong(a);
139 const uint16 low = (uint16)a, high = (uint16)(a >> 16);
140 return ((uint32)(uint16)((low >> 8) | (low << 8)) << 16)
141 | (uint16)((high >> 8) | (high << 8));
151 #if defined(__GNUC__) 154 return __builtin_bswap64(a);
157 #elif defined(_MSC_VER) 160 return _byteswap_uint64(a);
167 uint32 low = (uint32)a, high = (uint32)(a >> 32);
168 uint16 lowLow = (uint16)low, lowHigh = (uint16)(low >> 16),
169 highLow = (uint16)high, highHigh = (uint16)(high >> 16);
171 return ((uint64)(((uint32)(uint16)((lowLow >> 8) | (lowLow << 8)) << 16) |
172 (uint16)((lowHigh >> 8) | (lowHigh << 8))) << 32) |
173 (((uint32)(uint16)((highLow >> 8) | (highLow << 8)) << 16) |
174 (uint16)((highHigh >> 8) | (highHigh << 8)));
188 #define MKTAG(a0,a1,a2,a3) ((uint32)((a3) | ((a2) << 8) | ((a1) << 16) | ((a0) << 24))) 194 #define MKTAG16(a0,a1) ((uint16)((a1) | ((a0) << 8))) 205 #if defined(__GNUC__) 207 FORCEINLINE uint16 READ_UINT16(
const void *ptr) {
208 struct Unaligned16 { uint16 val; } __attribute__ ((__packed__, __may_alias__));
209 return ((
const Unaligned16 *)ptr)->val;
212 FORCEINLINE uint32 READ_UINT32(
const void *ptr) {
213 struct Unaligned32 { uint32 val; } __attribute__ ((__packed__, __may_alias__));
214 return ((
const Unaligned32 *)ptr)->val;
217 FORCEINLINE
void WRITE_UINT16(
void *ptr, uint16 value) {
218 struct Unaligned16 { uint16 val; } __attribute__ ((__packed__, __may_alias__));
219 ((Unaligned16 *)ptr)->val = value;
222 FORCEINLINE
void WRITE_UINT32(
void *ptr, uint32 value) {
223 struct Unaligned32 { uint32 val; } __attribute__ ((__packed__, __may_alias__));
224 ((Unaligned32 *)ptr)->val = value;
227 FORCEINLINE uint64 READ_UINT64(
const void *ptr) {
228 struct Unaligned64 { uint64 val; } __attribute__ ((__packed__, __may_alias__));
229 return ((
const Unaligned64 *)ptr)->val;
232 FORCEINLINE
void WRITE_UINT64(
void *ptr, uint64 value) {
233 struct Unaligned64 { uint64 val; } __attribute__((__packed__, __may_alias__));
234 ((Unaligned64 *)ptr)->val = value;
237 #elif !defined(SCUMM_NEED_ALIGNMENT) 239 FORCEINLINE uint16 READ_UINT16(
const void *ptr) {
240 return *(
const uint16 *)(ptr);
243 FORCEINLINE uint32 READ_UINT32(
const void *ptr) {
244 return *(
const uint32 *)(ptr);
247 FORCEINLINE
void WRITE_UINT16(
void *ptr, uint16 value) {
248 *(uint16 *)(ptr) = value;
251 FORCEINLINE
void WRITE_UINT32(
void *ptr, uint32 value) {
252 *(uint32 *)(ptr) = value;
255 FORCEINLINE uint64 READ_UINT64(
const void *ptr) {
256 return *(
const uint64 *)(ptr);
259 FORCEINLINE
void WRITE_UINT64(
void *ptr, uint64 value) {
260 *(uint64 *)(ptr) = value;
267 # if defined(SCUMM_LITTLE_ENDIAN) 269 inline uint16 READ_UINT16(
const void *ptr) {
270 const uint8 *b = (
const uint8 *)ptr;
271 return (b[1] << 8) | b[0];
273 inline uint32 READ_UINT32(
const void *ptr) {
274 const uint8 *b = (
const uint8 *)ptr;
275 return (b[3] << 24) | (b[2] << 16) | (b[1] << 8) | (b[0]);
277 inline void WRITE_UINT16(
void *ptr, uint16 value) {
278 uint8 *b = (uint8 *)ptr;
279 b[0] = (uint8)(value >> 0);
280 b[1] = (uint8)(value >> 8);
282 inline void WRITE_UINT32(
void *ptr, uint32 value) {
283 uint8 *b = (uint8 *)ptr;
284 b[0] = (uint8)(value >> 0);
285 b[1] = (uint8)(value >> 8);
286 b[2] = (uint8)(value >> 16);
287 b[3] = (uint8)(value >> 24);
289 inline uint64 READ_UINT64(
const void *ptr) {
290 const uint8 *b = (
const uint8 *)ptr;
291 return ((uint64)b[7] << 56) | ((uint64)b[6] << 48) | ((uint64)b[5] << 40) | ((uint64)b[4] << 32) | ((uint64)b[3] << 24) | ((uint64)b[2] << 16) | ((uint64)b[1] << 8) | ((uint64)b[0]);
293 inline void WRITE_UINT64(
void *ptr, uint64 value) {
294 uint8 *b = (uint8 *)ptr;
295 b[0] = (uint8)(value >> 0);
296 b[1] = (uint8)(value >> 8);
297 b[2] = (uint8)(value >> 16);
298 b[3] = (uint8)(value >> 24);
299 b[4] = (uint8)(value >> 32);
300 b[5] = (uint8)(value >> 40);
301 b[6] = (uint8)(value >> 48);
302 b[7] = (uint8)(value >> 56);
305 # elif defined(SCUMM_BIG_ENDIAN) 307 inline uint16 READ_UINT16(
const void *ptr) {
308 const uint8 *b = (
const uint8 *)ptr;
309 return (b[0] << 8) | b[1];
311 inline uint32 READ_UINT32(
const void *ptr) {
312 const uint8 *b = (
const uint8 *)ptr;
313 return (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | (b[3]);
315 inline void WRITE_UINT16(
void *ptr, uint16 value) {
316 uint8 *b = (uint8 *)ptr;
317 b[0] = (uint8)(value >> 8);
318 b[1] = (uint8)(value >> 0);
320 inline void WRITE_UINT32(
void *ptr, uint32 value) {
321 uint8 *b = (uint8 *)ptr;
322 b[0] = (uint8)(value >> 24);
323 b[1] = (uint8)(value >> 16);
324 b[2] = (uint8)(value >> 8);
325 b[3] = (uint8)(value >> 0);
327 inline uint64 READ_UINT64(
const void *ptr) {
328 const uint8 *b = (
const uint8 *)ptr;
329 return ((uint64)b[0] << 56) | ((uint64)b[1] << 48) | ((uint64)b[2] << 40) | ((uint64)b[3] << 32) | ((uint64)b[4] << 24) | ((uint64)b[5] << 16) | ((uint64)b[6] << 8) | ((uint64)b[7]);
331 inline void WRITE_UINT64(
void *ptr, uint64 value) {
332 uint8 *b = (uint8 *)ptr;
333 b[0] = (uint8)(value >> 56);
334 b[1] = (uint8)(value >> 48);
335 b[2] = (uint8)(value >> 40);
336 b[3] = (uint8)(value >> 32);
337 b[4] = (uint8)(value >> 24);
338 b[5] = (uint8)(value >> 16);
339 b[6] = (uint8)(value >> 8);
340 b[7] = (uint8)(value >> 0);
352 #if defined(SCUMM_LITTLE_ENDIAN) 354 #define READ_LE_UINT16(a) READ_UINT16(a) 355 #define READ_LE_UINT32(a) READ_UINT32(a) 357 #define WRITE_LE_UINT16(a, v) WRITE_UINT16(a, v) 358 #define WRITE_LE_UINT32(a, v) WRITE_UINT32(a, v) 360 #define FROM_LE_32(a) ((uint32)(a)) 361 #define FROM_LE_16(a) ((uint16)(a)) 363 #define FROM_BE_32(a) SWAP_BYTES_32(a) 364 #define FROM_BE_16(a) SWAP_BYTES_16(a) 366 #define TO_LE_32(a) ((uint32)(a)) 367 #define TO_LE_16(a) ((uint16)(a)) 369 #define TO_BE_32(a) SWAP_BYTES_32(a) 370 #define TO_BE_16(a) SWAP_BYTES_16(a) 372 #define CONSTANT_LE_32(a) ((uint32)(a)) 373 #define CONSTANT_LE_16(a) ((uint16)(a)) 375 #define CONSTANT_BE_32(a) SWAP_CONSTANT_32(a) 376 #define CONSTANT_BE_16(a) SWAP_CONSTANT_16(a) 378 #define READ_LE_UINT64(a) READ_UINT64(a) 379 #define WRITE_LE_UINT64(a, v) WRITE_UINT64(a, v) 380 #define FROM_LE_64(a) ((uint64)(a)) 381 #define FROM_BE_64(a) SWAP_BYTES_64(a) 382 #define TO_LE_64(a) ((uint64)(a)) 383 #define TO_BE_64(a) SWAP_BYTES_64(a) 384 #define CONSTANT_LE_64(a) ((uint64)(a)) 385 #define CONSTANT_BE_64(a) SWAP_CONSTANT_64(a) 393 # if defined(SCUMM_NEED_ALIGNMENT) && !defined(__mips__) 395 inline uint16 READ_BE_UINT16(
const void *ptr) {
396 const uint8 *b = (
const uint8 *)ptr;
397 return (b[0] << 8) | b[1];
399 inline uint32 READ_BE_UINT32(
const void *ptr) {
400 const uint8 *b = (
const uint8 *)ptr;
401 return (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | (b[3]);
403 inline void WRITE_BE_UINT16(
void *ptr, uint16 value) {
404 uint8 *b = (uint8 *)ptr;
405 b[0] = (uint8)(value >> 8);
406 b[1] = (uint8)(value >> 0);
408 inline void WRITE_BE_UINT32(
void *ptr, uint32 value) {
409 uint8 *b = (uint8 *)ptr;
410 b[0] = (uint8)(value >> 24);
411 b[1] = (uint8)(value >> 16);
412 b[2] = (uint8)(value >> 8);
413 b[3] = (uint8)(value >> 0);
415 inline uint64 READ_BE_UINT64(
const void *ptr) {
416 const uint8 *b = (
const uint8 *)ptr;
417 return ((uint64)b[0] << 56) | ((uint64)b[1] << 48) | ((uint64)b[2] << 40) | ((uint64)b[3] << 32) | ((uint64)b[4] << 24) | ((uint64)b[5] << 16) | ((uint64)b[6] << 8) | ((uint64)b[7]);
419 inline void WRITE_BE_UINT64(
void *ptr, uint64 value) {
420 uint8 *b = (uint8 *)ptr;
421 b[0] = (uint8)(value >> 56);
422 b[1] = (uint8)(value >> 48);
423 b[2] = (uint8)(value >> 40);
424 b[3] = (uint8)(value >> 32);
425 b[4] = (uint8)(value >> 24);
426 b[5] = (uint8)(value >> 16);
427 b[6] = (uint8)(value >> 8);
428 b[7] = (uint8)(value >> 0);
433 inline uint16 READ_BE_UINT16(
const void *ptr) {
436 inline uint32 READ_BE_UINT32(
const void *ptr) {
439 inline void WRITE_BE_UINT16(
void *ptr, uint16 value) {
442 inline void WRITE_BE_UINT32(
void *ptr, uint32 value) {
445 inline uint64 READ_BE_UINT64(
const void *ptr) {
448 inline void WRITE_BE_UINT64(
void *ptr, uint64 value) {
452 # endif // if defined(SCUMM_NEED_ALIGNMENT) 454 #elif defined(SCUMM_BIG_ENDIAN) 456 #define READ_BE_UINT16(a) READ_UINT16(a) 457 #define READ_BE_UINT32(a) READ_UINT32(a) 459 #define WRITE_BE_UINT16(a, v) WRITE_UINT16(a, v) 460 #define WRITE_BE_UINT32(a, v) WRITE_UINT32(a, v) 462 #define FROM_LE_32(a) SWAP_BYTES_32(a) 463 #define FROM_LE_16(a) SWAP_BYTES_16(a) 465 #define FROM_BE_32(a) ((uint32)(a)) 466 #define FROM_BE_16(a) ((uint16)(a)) 468 #define TO_LE_32(a) SWAP_BYTES_32(a) 469 #define TO_LE_16(a) SWAP_BYTES_16(a) 471 #define TO_BE_32(a) ((uint32)(a)) 472 #define TO_BE_16(a) ((uint16)(a)) 474 #define CONSTANT_LE_32(a) SWAP_CONSTANT_32(a) 475 #define CONSTANT_LE_16(a) SWAP_CONSTANT_16(a) 477 #define CONSTANT_BE_32(a) ((uint32)(a)) 478 #define CONSTANT_BE_16(a) ((uint16)(a)) 480 #define READ_BE_UINT64(a) READ_UINT64(a) 481 #define WRITE_BE_UINT64(a, v) WRITE_UINT64(a, v) 482 #define FROM_LE_64(a) SWAP_BYTES_64(a) 483 #define FROM_BE_64(a) ((uint64)(a)) 484 #define TO_LE_64(a) SWAP_BYTES_64(a) 485 #define TO_BE_64(a) ((uint64)(a)) 486 #define CONSTANT_LE_64(a) SWAP_CONSTANT_64(a) 487 #define CONSTANT_BE_64(a) ((uint64)(a)) 490 # if defined(SCUMM_NEED_ALIGNMENT) && !defined(__mips__) 492 inline uint16 READ_LE_UINT16(
const void *ptr) {
493 const uint8 *b = (
const uint8 *)ptr;
494 return (b[1] << 8) | b[0];
496 inline uint32 READ_LE_UINT32(
const void *ptr) {
497 const uint8 *b = (
const uint8 *)ptr;
498 return (b[3] << 24) | (b[2] << 16) | (b[1] << 8) | (b[0]);
500 inline void WRITE_LE_UINT16(
void *ptr, uint16 value) {
501 uint8 *b = (uint8 *)ptr;
502 b[0] = (uint8)(value >> 0);
503 b[1] = (uint8)(value >> 8);
505 inline void WRITE_LE_UINT32(
void *ptr, uint32 value) {
506 uint8 *b = (uint8 *)ptr;
507 b[0] = (uint8)(value >> 0);
508 b[1] = (uint8)(value >> 8);
509 b[2] = (uint8)(value >> 16);
510 b[3] = (uint8)(value >> 24);
513 inline uint64 READ_LE_UINT64(
const void *ptr) {
514 const uint8 *b = (
const uint8 *)ptr;
515 return ((uint64)b[7] << 56) | ((uint64)b[6] << 48) | ((uint64)b[5] << 40) | ((uint64)b[4] << 32) | ((uint64)b[3] << 24) | ((uint64)b[2] << 16) | ((uint64)b[1] << 8) | ((uint64)b[0]);
517 inline void WRITE_LE_UINT64(
void *ptr, uint64 value) {
518 uint8 *b = (uint8 *)ptr;
519 b[0] = (uint8)(value >> 0);
520 b[1] = (uint8)(value >> 8);
521 b[2] = (uint8)(value >> 16);
522 b[3] = (uint8)(value >> 24);
523 b[4] = (uint8)(value >> 32);
524 b[5] = (uint8)(value >> 40);
525 b[6] = (uint8)(value >> 48);
526 b[7] = (uint8)(value >> 56);
531 inline uint16 READ_LE_UINT16(
const void *ptr) {
534 inline uint32 READ_LE_UINT32(
const void *ptr) {
537 inline void WRITE_LE_UINT16(
void *ptr, uint16 value) {
540 inline void WRITE_LE_UINT32(
void *ptr, uint32 value) {
543 inline uint64 READ_LE_UINT64(
const void *ptr) {
546 inline void WRITE_LE_UINT64(
void *ptr, uint64 value) {
550 # endif // if defined(SCUMM_NEED_ALIGNMENT) 552 #endif // if defined(SCUMM_LITTLE_ENDIAN) 554 inline uint32 READ_LE_UINT24(
const void *ptr) {
555 const uint8 *b = (
const uint8 *)ptr;
556 return (b[2] << 16) | (b[1] << 8) | (b[0]);
559 inline void WRITE_LE_UINT24(
void *ptr, uint32 value) {
560 uint8 *b = (uint8 *)ptr;
561 b[0] = (uint8)(value >> 0);
562 b[1] = (uint8)(value >> 8);
563 b[2] = (uint8)(value >> 16);
566 inline uint32 READ_BE_UINT24(
const void *ptr) {
567 const uint8 *b = (
const uint8 *)ptr;
568 return (b[0] << 16) | (b[1] << 8) | (b[2]);
571 inline void WRITE_BE_UINT24(
void *ptr, uint32 value) {
572 uint8 *b = (uint8 *)ptr;
573 b[0] = (uint8)(value >> 16);
574 b[1] = (uint8)(value >> 8);
575 b[2] = (uint8)(value >> 0);
578 #ifdef SCUMM_LITTLE_ENDIAN 579 #define READ_UINT24(a) READ_LE_UINT24(a) 580 #define WRITE_UINT24(a,b) WRITE_LE_UINT24(a,b) 582 #define READ_UINT24(a) READ_BE_UINT24(a) 583 #define WRITE_UINT24(a,b) WRITE_BE_UINT24(a,b) 591 STATIC_ASSERT(
sizeof(
float) ==
sizeof(uint32), Unexpected_size_of_float);
593 inline float READ_LE_FLOAT32(
const void *ptr) {
595 swap.u32 = READ_LE_UINT32(ptr);
599 inline void WRITE_LE_FLOAT32(
void *ptr,
float value) {
602 WRITE_LE_UINT32(ptr, swap.u32);
605 inline float READ_BE_FLOAT32(
const void *ptr) {
607 swap.u32 = READ_BE_UINT32(ptr);
611 inline void WRITE_BE_FLOAT32(
void *ptr,
float value) {
614 WRITE_BE_UINT32(ptr, swap.u32);
617 #ifdef SCUMM_LITTLE_ENDIAN 618 #define READ_FLOAT32(a) READ_LE_FLOAT32(a) 619 #define WRITE_FLOAT32(a,b) WRITE_LE_FLOAT32(a,b) 621 #define READ_FLOAT32(a) READ_BE_FLOAT32(a) 622 #define WRITE_FLOAT32(a,b) WRITE_BE_FLOAT32(a,b) 625 #ifdef SCUMM_FLOAT_WORD_LITTLE_ENDIAN 643 STATIC_ASSERT(
sizeof(
double) ==
sizeof(uint64) ||
sizeof(
double) ==
sizeof(uint32), Unexpected_size_of_double);
645 template<
size_t n>
inline double READ_DOUBLE(
const SwapDouble& sw);
646 template<
size_t n>
inline void WRITE_DOUBLE(
SwapDouble &sw,
double d);
649 template<>
inline double READ_DOUBLE<sizeof(uint64)>(
const SwapDouble& sd)
654 template<>
inline void WRITE_DOUBLE<sizeof(uint64)>(
SwapDouble &sd,
double d)
660 template<>
inline double READ_DOUBLE<sizeof(uint32)>(
const SwapDouble& sd)
663 uint32 e = (sd.u32.high >> 20) & 0x7ff;
667 sf.u32 = (sd.u32.high & 0x80000000U);
669 }
else if(e >= 1151) {
673 sf.u32 = (sd.u32.high & 0x80000000U) |
680 sf.u32 = (sd.u32.high & 0x80000000U) |
682 ((sd.u32.high & 0xfffff) << 3) | (sd.u32.low >> 29);
686 template<>
inline void WRITE_DOUBLE<sizeof(uint32)>(
SwapDouble &sd,
double d)
690 uint32 e = (sf.u32 >> 23) & 0xff;
694 sd.u32.high = (sf.u32 & 0x80000000U);
697 }
else if (e == 255) {
702 sd.u32.high = (sf.u32 & 0x80000000U) |
704 ((sf.u32 >> 3) & 0xfffff);
705 sd.u32.low = sf.u32 << 29;
708 inline double READ_LE_FLOAT64(
const void *ptr) {
710 const uint8 *b = (
const uint8 *)ptr;
711 swap.u32.low = READ_LE_UINT32(b);
712 swap.u32.high = READ_LE_UINT32(b + 4);
713 return READ_DOUBLE<sizeof(double)>(swap);
716 inline void WRITE_LE_FLOAT64(
void *ptr,
double value) {
718 WRITE_DOUBLE<sizeof(double)>(swap, value);
719 uint8 *b = (uint8 *)ptr;
720 WRITE_LE_UINT32(b, swap.u32.low);
721 WRITE_LE_UINT32(b + 4, swap.u32.high);
724 inline double READ_BE_FLOAT64(
const void *ptr) {
726 const uint8 *b = (
const uint8 *)ptr;
727 swap.u32.high = READ_BE_UINT32(b);
728 swap.u32.low = READ_BE_UINT32(b + 4);
729 return READ_DOUBLE<sizeof(double)>(swap);
732 inline void WRITE_BE_FLOAT64(
void *ptr,
double value) {
734 WRITE_DOUBLE<sizeof(double)>(swap, value);
735 uint8 *b = (uint8 *)ptr;
736 WRITE_BE_UINT32(b, swap.u32.high);
737 WRITE_BE_UINT32(b + 4, swap.u32.low);
740 inline double READ_FPA_FLOAT64(
const void *ptr) {
742 const uint8 *b = (
const uint8 *)ptr;
743 swap.u32.high = READ_LE_UINT32(b);
744 swap.u32.low = READ_LE_UINT32(b + 4);
745 return READ_DOUBLE<sizeof(double)>(swap);
748 inline void WRITE_FPA_FLOAT64(
void *ptr,
double value) {
750 WRITE_DOUBLE<sizeof(double)>(swap, value);
751 uint8 *b = (uint8 *)ptr;
752 WRITE_LE_UINT32(b, swap.u32.high);
753 WRITE_LE_UINT32(b + 4, swap.u32.low);
756 inline double READ_FLOAT64(
const void *ptr) {
758 swap.u64 = READ_UINT64(ptr);
759 return READ_DOUBLE<sizeof(double)>(swap);
762 inline void WRITE_FLOAT64(
void *ptr,
double value) {
764 WRITE_DOUBLE<sizeof(double)>(swap, value);
765 WRITE_UINT64(ptr, swap.u64);
768 inline int16 READ_LE_INT16(
const void *ptr) {
769 return static_cast<int16
>(READ_LE_UINT16(ptr));
772 inline void WRITE_LE_INT16(
void *ptr, int16 value) {
773 WRITE_LE_UINT16(ptr, static_cast<uint16>(value));
776 inline int16 READ_BE_INT16(
const void *ptr) {
777 return static_cast<int16
>(READ_BE_UINT16(ptr));
780 inline void WRITE_BE_INT16(
void *ptr, int16 value) {
781 WRITE_BE_UINT16(ptr, static_cast<uint16>(value));
784 inline int32 READ_LE_INT32(
const void *ptr) {
785 return static_cast<int32
>(READ_LE_UINT32(ptr));
788 inline void WRITE_LE_INT32(
void *ptr, int32 value) {
789 WRITE_LE_UINT32(ptr, static_cast<uint32>(value));
792 inline int32 READ_BE_INT32(
const void *ptr) {
793 return static_cast<int32
>(READ_BE_UINT32(ptr));
796 inline void WRITE_BE_INT32(
void *ptr, int32 value) {
797 WRITE_BE_UINT32(ptr, static_cast<uint32>(value));
uint64 SWAP_BYTES_64(uint64 a)
Definition: endian.h:166
uint32 SWAP_BYTES_32(uint32 a)
Definition: endian.h:138
uint16 SWAP_BYTES_16(const uint16 a)
Definition: endian.h:110