From 885cda971d37cedf5666742a8360eac8dfed8f56 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 13 Mar 2023 03:59:14 +0300 Subject: [PATCH] engine: common: net_buffer: fix strict aliasing by converting it to use float_bits_t union --- engine/common/net_buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/common/net_buffer.c b/engine/common/net_buffer.c index 2ec7b008..5de65391 100644 --- a/engine/common/net_buffer.c +++ b/engine/common/net_buffer.c @@ -366,7 +366,7 @@ void MSG_WriteBitFloat( sizebuf_t *sb, float val ) Assert( sizeof( int ) == sizeof( float )); Assert( sizeof( float ) == 4 ); - intVal = *((int *)&val ); + intVal = FloatAsInt( val ); MSG_WriteUBitLong( sb, intVal, 32 ); } @@ -546,7 +546,7 @@ float MSG_ReadBitFloat( sizebuf_t *sb ) val |= ((int)sb->pData[byte + 4]) << ( 32 - bit ); sb->iCurBit += 32; - return *((float *)&val); + return IntAsFloat( val ); } qboolean MSG_ReadBits( sizebuf_t *sb, void *pOutData, int nBits )