Index: src/runtime/runtime-maths.cc |
diff --git a/src/runtime/runtime-maths.cc b/src/runtime/runtime-maths.cc |
index 68dfa49af839abb99a6027e021a400e83f77f674..24b794cf21782e89c775d08abfdca6caeaa58137 100644 |
--- a/src/runtime/runtime-maths.cc |
+++ b/src/runtime/runtime-maths.cc |
@@ -34,9 +34,10 @@ RUNTIME_FUNCTION(Runtime_DoubleHi) { |
HandleScope scope(isolate); |
DCHECK(args.length() == 1); |
CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
- uint64_t integer = double_to_uint64(x); |
- integer = (integer >> 32) & 0xFFFFFFFFu; |
- return *isolate->factory()->NewNumber(static_cast<int32_t>(integer)); |
+ uint64_t unsigned64 = double_to_uint64(x); |
+ uint32_t unsigned32 = static_cast<uint32_t>(unsigned64 >> 32); |
+ int32_t signed32 = bit_cast<int32_t, uint32_t>(unsigned32); |
+ return *isolate->factory()->NewNumber(signed32); |
} |
@@ -44,8 +45,10 @@ RUNTIME_FUNCTION(Runtime_DoubleLo) { |
HandleScope scope(isolate); |
DCHECK(args.length() == 1); |
CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
- return *isolate->factory()->NewNumber( |
- static_cast<int32_t>(double_to_uint64(x) & 0xFFFFFFFFu)); |
+ uint64_t unsigned64 = double_to_uint64(x); |
+ uint32_t unsigned32 = static_cast<uint32_t>(unsigned64); |
+ int32_t signed32 = bit_cast<int32_t, uint32_t>(unsigned32); |
+ return *isolate->factory()->NewNumber(signed32); |
} |