From f8d5f6890f62c4e7e2ec490c8b3a831948685a3d Mon Sep 17 00:00:00 2001 From: NepDisk Date: Sat, 8 Nov 2025 02:20:17 -0500 Subject: [PATCH] fix SINT8 write macro, fix big endian READUINT32 macro Thanks alug for these past couple commits --- src/byteptr.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/byteptr.h b/src/byteptr.h index 2858ccde7..950a5a92b 100644 --- a/src/byteptr.h +++ b/src/byteptr.h @@ -31,7 +31,7 @@ extern "C" { // #ifdef DEALIGNED #define WRITEUINT8(p,b) do { UINT8 *p_tmp = ( UINT8 *)p; const UINT8 tv = ( UINT8)(b); memcpy(p, &tv, sizeof( UINT8)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0) -#define WRITESINT8(p,b) do { SINT8 *p_tmp = ( SINT8 *)p; const SINT8 tv = ( UINT8)(b); memcpy(p, &tv, sizeof( UINT8)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0) +#define WRITESINT8(p,b) do { SINT8 *p_tmp = ( SINT8 *)p; const SINT8 tv = ( SINT8)(b); memcpy(p, &tv, sizeof( SINT8)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0) #define WRITEINT16(p,b) do { INT16 *p_tmp = ( INT16 *)p; const INT16 tv = ( INT16)(b); memcpy(p, &tv, sizeof( INT16)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0) #define WRITEUINT16(p,b) do { UINT16 *p_tmp = ( UINT16 *)p; const UINT16 tv = ( UINT16)(b); memcpy(p, &tv, sizeof( UINT16)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0) #define WRITEINT32(p,b) do { INT32 *p_tmp = ( INT32 *)p; const INT32 tv = ( INT32)(b); memcpy(p, &tv, sizeof( INT32)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0) @@ -163,7 +163,7 @@ FUNCINLINE static ATTRINLINE UINT64 readulonglong(void *ptr) #define READINT16(p) readshort(&((const INT16*)(p = (const void*)&((const INT16*)p)[1]))[-1]) #define READUINT16(p) readushort(&((const UINT16*)(p = (const void*)&((const UINT16*)p)[1]))[-1]) #define READINT32(p) readlong(&((const INT32*)(p = (const void*)&((const INT32*)p)[1]))[-1]) -#define READUINT32(p) readulong(&((const UINT32*)(p = (const void*)&((const UINT32*)p)[1])) +#define READUINT32(p) readulong(&((const UINT32*)(p = (const void*)&((const UINT32*)p)[1]))[-1]) #define READUINT64(p) readulonglong(&((const UINT64*)(p = (const void*)&((const UINT64*)p)[1])) #define READCHAR(p) ((const char*)(p = (const void*)&((const char*)p)[1]))[-1] #define READFIXED(p) readlong(&((const fixed_t*)(p = (const void*)&((const fixed_t*)p)[1]))[-1])