byteptr.h: include endian.h to help define WRITE/READ macros correctly according to endianness

This commit is contained in:
Monster Iestyn 2018-11-08 17:16:54 +00:00
parent fd20bbb54e
commit fa80d61799

View file

@ -15,7 +15,9 @@
#define DEALIGNED #define DEALIGNED
#endif #endif
#ifndef _BIG_ENDIAN #include "endian.h"
#ifndef SRB2_BIG_ENDIAN
// //
// Little-endian machines // Little-endian machines
// //
@ -75,7 +77,7 @@
#define READANGLE(p) *((angle_t *)p)++ #define READANGLE(p) *((angle_t *)p)++
#endif #endif
#else //_BIG_ENDIAN #else //SRB2_BIG_ENDIAN
// //
// definitions for big-endian machines with alignment constraints. // definitions for big-endian machines with alignment constraints.
// //
@ -144,7 +146,7 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr)
#define READCHAR(p) ({ char *p_tmp = ( char *)p; char b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; }) #define READCHAR(p) ({ char *p_tmp = ( char *)p; char b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; })
#define READFIXED(p) ({ fixed_t *p_tmp = (fixed_t *)p; fixed_t b = readlong(p); p_tmp++; p = (void *)p_tmp; b; }) #define READFIXED(p) ({ fixed_t *p_tmp = (fixed_t *)p; fixed_t b = readlong(p); p_tmp++; p = (void *)p_tmp; b; })
#define READANGLE(p) ({ angle_t *p_tmp = (angle_t *)p; angle_t b = readulong(p); p_tmp++; p = (void *)p_tmp; b; }) #define READANGLE(p) ({ angle_t *p_tmp = (angle_t *)p; angle_t b = readulong(p); p_tmp++; p = (void *)p_tmp; b; })
#endif //_BIG_ENDIAN #endif //SRB2_BIG_ENDIAN
#undef DEALIGNED #undef DEALIGNED