engine: common: avoid sign bit loss in MSG_WriteBitLong

This commit is contained in:
Alibek Omarov 2021-06-01 17:57:54 +03:00
parent 13a3f22001
commit d54a648792
2 changed files with 4 additions and 4 deletions

View File

@ -214,11 +214,11 @@ void MSG_WriteSBitLong( sizebuf_t *sb, int data, int numbits )
}
}
void MSG_WriteBitLong( sizebuf_t *sb, int data, int numbits, qboolean bSigned )
void MSG_WriteBitLong( sizebuf_t *sb, uint data, int numbits, qboolean bSigned )
{
if( bSigned )
MSG_WriteSBitLong( sb, data, numbits );
else MSG_WriteUBitLong( sb, (uint)data, numbits );
MSG_WriteSBitLong( sb, (int)data, numbits );
else MSG_WriteUBitLong( sb, data, numbits );
}
qboolean MSG_WriteBits( sizebuf_t *sb, const void *pData, int nBits )

View File

@ -73,7 +73,7 @@ void MSG_Clear( sizebuf_t *sb );
void MSG_WriteOneBit( sizebuf_t *sb, int nValue );
void MSG_WriteUBitLong( sizebuf_t *sb, uint curData, int numbits );
void MSG_WriteSBitLong( sizebuf_t *sb, int data, int numbits );
void MSG_WriteBitLong( sizebuf_t *sb, int data, int numbits, qboolean bSigned );
void MSG_WriteBitLong( sizebuf_t *sb, uint data, int numbits, qboolean bSigned );
qboolean MSG_WriteBits( sizebuf_t *sb, const void *pData, int nBits );
void MSG_WriteBitAngle( sizebuf_t *sb, float fAngle, int numbits );
void MSG_WriteBitFloat( sizebuf_t *sb, float val );