OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "include/v8stdint.h" | 5 #include "include/v8stdint.h" |
6 #include "src/checks.h" | 6 #include "src/base/logging.h" |
7 #include "src/diy-fp.h" | 7 #include "src/diy-fp.h" |
8 #include "src/globals.h" | 8 #include "src/globals.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
11 namespace internal { | 11 namespace internal { |
12 | 12 |
13 void DiyFp::Multiply(const DiyFp& other) { | 13 void DiyFp::Multiply(const DiyFp& other) { |
14 // Simply "emulates" a 128 bit multiplication. | 14 // Simply "emulates" a 128 bit multiplication. |
15 // However: the resulting number only contains 64 bits. The least | 15 // However: the resulting number only contains 64 bits. The least |
16 // significant 64 bits are only used for rounding the most significant 64 | 16 // significant 64 bits are only used for rounding the most significant 64 |
(...skipping 10 matching lines...) Expand all Loading... |
27 uint64_t tmp = (bd >> 32) + (ad & kM32) + (bc & kM32); | 27 uint64_t tmp = (bd >> 32) + (ad & kM32) + (bc & kM32); |
28 // By adding 1U << 31 to tmp we round the final result. | 28 // By adding 1U << 31 to tmp we round the final result. |
29 // Halfway cases will be round up. | 29 // Halfway cases will be round up. |
30 tmp += 1U << 31; | 30 tmp += 1U << 31; |
31 uint64_t result_f = ac + (ad >> 32) + (bc >> 32) + (tmp >> 32); | 31 uint64_t result_f = ac + (ad >> 32) + (bc >> 32) + (tmp >> 32); |
32 e_ += other.e_ + 64; | 32 e_ += other.e_ + 64; |
33 f_ = result_f; | 33 f_ = result_f; |
34 } | 34 } |
35 | 35 |
36 } } // namespace v8::internal | 36 } } // namespace v8::internal |
OLD | NEW |