Fixed conversion warnings in bitbuf

This commit is contained in:
Jordan Cristiano 2015-05-15 17:43:20 -04:00
parent f5878e872b
commit 3c2dc07c82

View File

@ -951,7 +951,7 @@ float bf_read::ReadBitAngle( int numbits )
shift = (float)( BitForBitnum(numbits) ); shift = (float)( BitForBitnum(numbits) );
i = ReadUBitLong( numbits ); i = ReadUBitLong( numbits );
fReturn = (float)i * (360.0 / shift); fReturn = static_cast<float>(i * (360.0 / shift));
return fReturn; return fReturn;
} }
@ -1110,7 +1110,7 @@ float bf_read::ReadBitCoord (void)
} }
// Calculate the correct floating point value // Calculate the correct floating point value
value = intval + ((float)fractval * COORD_RESOLUTION); value = intval + static_cast<float>((float)fractval * COORD_RESOLUTION);
// Fixup the sign if negative. // Fixup the sign if negative.
if ( signbit ) if ( signbit )
@ -1141,7 +1141,7 @@ float bf_read::ReadBitCoordMP( bool bIntegral, bool bLowPrecision )
unsigned int bits = ReadUBitLong( (flags & INBOUNDS) ? COORD_INTEGER_BITS_MP+1 : COORD_INTEGER_BITS+1 ); unsigned int bits = ReadUBitLong( (flags & INBOUNDS) ? COORD_INTEGER_BITS_MP+1 : COORD_INTEGER_BITS+1 );
// Remap from [0,N] to [1,N+1] // Remap from [0,N] to [1,N+1]
int intval = (bits >> 1) + 1; int intval = (bits >> 1) + 1;
return (bits & 1) ? -intval : intval; return static_cast<float>((bits & 1) ? -intval : intval);
} }
return 0.f; return 0.f;
} }
@ -1294,7 +1294,7 @@ float bf_read::ReadBitNormal (void)
unsigned int fractval = ReadUBitLong( NORMAL_FRACTIONAL_BITS ); unsigned int fractval = ReadUBitLong( NORMAL_FRACTIONAL_BITS );
// Calculate the correct floating point value // Calculate the correct floating point value
float value = (float)fractval * NORMAL_RESOLUTION; float value = static_cast<float>((float)fractval * NORMAL_RESOLUTION);
// Fixup the sign if negative. // Fixup the sign if negative.
if ( signbit ) if ( signbit )