diff options
author | Aaron <aaron@10gen.com> | 2010-01-20 18:40:19 -0800 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2010-01-20 18:40:19 -0800 |
commit | 6a78423e5d777bd9fb4c077e1e6ae1a1afecd6fa (patch) | |
tree | ace6e4f41bc22dd410f7056c13d1a70e57337b82 /scripting | |
parent | ed1b8154241e81d9fea5bd4ed9b2b710e2f71aea (diff) | |
download | mongo-6a78423e5d777bd9fb4c077e1e6ae1a1afecd6fa.tar.gz |
SERVER-357 use consistent bit depth when converting between ints and floats
Diffstat (limited to 'scripting')
-rw-r--r-- | scripting/engine_spidermonkey.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/scripting/engine_spidermonkey.cpp b/scripting/engine_spidermonkey.cpp index 079d7f5b8e2..4b395f560b2 100644 --- a/scripting/engine_spidermonkey.cpp +++ b/scripting/engine_spidermonkey.cpp @@ -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: { |