SERVER-357 use consistent bit depth when converting between ints and floats

This commit is contained in:
Aaron
2010-01-20 18:40:19 -08:00
parent ed1b815424
commit 6a78423e5d

View File

@@ -161,7 +161,7 @@ namespace mongo {
// NOTE No validation of passed in object
long long toNumberLongUnsafe( JSObject *o ) {
boost::uint64_t val =
( (boost::uint64_t)( getNumber( o , "top" ) ) << 32 ) +
( (boost::uint64_t)(boost::uint32_t)getNumber( o , "top" ) << 32 ) +
( boost::uint32_t)( getNumber( o , "bottom" ) );
return val;
}
@@ -569,8 +569,8 @@ namespace mongo {
JSObject * o = JS_NewObject( _context , &numberlong_class , 0 , 0 );
// using 2 doubles here instead of a single double because certain double
// bit patterns represent undefined values and sm might trash them
setProperty( o , "top" , toval( (double)( val >> 32 ) ) );
setProperty( o , "bottom" , toval( (double)( val & 0x00000000ffffffff ) ) );
setProperty( o , "top" , toval( (double)(boost::uint32_t)( val >> 32 ) ) );
setProperty( o , "bottom" , toval( (double)(boost::uint32_t)( val & 0x00000000ffffffff ) ) );
return OBJECT_TO_JSVAL( o );
}
case DBRef: {