Browse Source

engine: common: net_encode: fix strict aliasing by converting it to use float_bits_t union

pull/2/head
Alibek Omarov 2 years ago
parent
commit
d4610e30fd
  1. 8
      engine/common/net_encode.c

8
engine/common/net_encode.c

@ -1009,8 +1009,8 @@ qboolean Delta_CompareField( delta_t *pField, void *from, void *to, double timeb
val_b = Q_rint((*(float *)((byte *)to + pField->offset )) * 100.0 ); val_b = Q_rint((*(float *)((byte *)to + pField->offset )) * 100.0 );
val_a -= Q_rint(timebase * 100.0); val_a -= Q_rint(timebase * 100.0);
val_b -= Q_rint(timebase * 100.0); val_b -= Q_rint(timebase * 100.0);
fromF = *((int *)&val_a); fromF = FloatAsInt( val_a );
toF = *((int *)&val_b); toF = FloatAsInt( val_b );
} }
else if( pField->flags & DT_TIMEWINDOW_BIG ) else if( pField->flags & DT_TIMEWINDOW_BIG )
{ {
@ -1030,8 +1030,8 @@ qboolean Delta_CompareField( delta_t *pField, void *from, void *to, double timeb
val_b = timebase - val_b; val_b = timebase - val_b;
} }
fromF = *((int *)&val_a); fromF = FloatAsInt( val_a );
toF = *((int *)&val_b); toF = FloatAsInt( val_b );
} }
else if( pField->flags & DT_STRING ) else if( pField->flags & DT_STRING )
{ {

Loading…
Cancel
Save