mirror of
https://github.com/w23/xash3d-fwgs
synced 2024-12-15 13:41:33 +01:00
engine: common: net_buffer: fix strict aliasing by converting it to use float_bits_t union
This commit is contained in:
parent
ef0b227967
commit
885cda971d
@ -366,7 +366,7 @@ void MSG_WriteBitFloat( sizebuf_t *sb, float val )
|
|||||||
Assert( sizeof( int ) == sizeof( float ));
|
Assert( sizeof( int ) == sizeof( float ));
|
||||||
Assert( sizeof( float ) == 4 );
|
Assert( sizeof( float ) == 4 );
|
||||||
|
|
||||||
intVal = *((int *)&val );
|
intVal = FloatAsInt( val );
|
||||||
MSG_WriteUBitLong( sb, intVal, 32 );
|
MSG_WriteUBitLong( sb, intVal, 32 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -546,7 +546,7 @@ float MSG_ReadBitFloat( sizebuf_t *sb )
|
|||||||
val |= ((int)sb->pData[byte + 4]) << ( 32 - bit );
|
val |= ((int)sb->pData[byte + 4]) << ( 32 - bit );
|
||||||
sb->iCurBit += 32;
|
sb->iCurBit += 32;
|
||||||
|
|
||||||
return *((float *)&val);
|
return IntAsFloat( val );
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean MSG_ReadBits( sizebuf_t *sb, void *pOutData, int nBits )
|
qboolean MSG_ReadBits( sizebuf_t *sb, void *pOutData, int nBits )
|
||||||
|
Loading…
Reference in New Issue
Block a user