From 1df6a040ec9a181b98aa2d797fa07de183fc4d4b Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Tue, 21 Apr 2026 23:42:48 +0500 Subject: [PATCH] engine: common: fix WriteBits/ReadBits --- engine/common/net_buffer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/engine/common/net_buffer.c b/engine/common/net_buffer.c index fe5f537c..637a9b35 100644 --- a/engine/common/net_buffer.c +++ b/engine/common/net_buffer.c @@ -400,7 +400,8 @@ qboolean MSG_WriteBits( sizebuf_t *sb, const void *pData, int nBits ) // read dwords. while( nBitsLeft >= 32 ) { - MSG_WriteUBitLong( sb, *(( uint32_t *)pOut ), 32 ); + uint32_t dword = *((uint32_t *)pOut); + MSG_WriteUBitLong( sb, LittleLong( dword ), 32 ); pOut += sizeof( uint32_t ); nBitsLeft -= 32; @@ -637,7 +638,8 @@ qboolean MSG_ReadBits( sizebuf_t *sb, void *pOutData, int nBits ) // read dwords. while( nBitsLeft >= 32 ) { - *((uint32_t *)pOut) = MSG_ReadUBitLong( sb, 32 ); + uint32_t dword = MSG_ReadUBitLong( sb, 32 ); + *((uint32_t *)pOut) = LittleLong( dword ); pOut += sizeof( uint32_t ); nBitsLeft -= 32; }