OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 "src/base/bits.h" | 5 #include "src/base/bits.h" |
6 #include "src/base/logging.h" | 6 #include "src/base/logging.h" |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace base { | 9 namespace base { |
10 namespace bits { | 10 namespace bits { |
(...skipping 14 matching lines...) Expand all Loading... |
25 int64_t const value = static_cast<int64_t>(lhs) * static_cast<int64_t>(rhs); | 25 int64_t const value = static_cast<int64_t>(lhs) * static_cast<int64_t>(rhs); |
26 return bit_cast<int32_t, uint32_t>(bit_cast<uint64_t>(value) >> 32u); | 26 return bit_cast<int32_t, uint32_t>(bit_cast<uint64_t>(value) >> 32u); |
27 } | 27 } |
28 | 28 |
29 | 29 |
30 int32_t SignedMulHighAndAdd32(int32_t lhs, int32_t rhs, int32_t acc) { | 30 int32_t SignedMulHighAndAdd32(int32_t lhs, int32_t rhs, int32_t acc) { |
31 return bit_cast<int32_t>(bit_cast<uint32_t>(acc) + | 31 return bit_cast<int32_t>(bit_cast<uint32_t>(acc) + |
32 bit_cast<uint32_t>(SignedMulHigh32(lhs, rhs))); | 32 bit_cast<uint32_t>(SignedMulHigh32(lhs, rhs))); |
33 } | 33 } |
34 | 34 |
35 | |
36 int32_t SignedMulHighAndSub32(int32_t lhs, int32_t rhs, int32_t acc) { | |
37 return bit_cast<int32_t>(bit_cast<uint32_t>(acc) - | |
38 bit_cast<uint32_t>(SignedMulHigh32(lhs, rhs))); | |
39 } | |
40 | |
41 | |
42 } // namespace bits | 35 } // namespace bits |
43 } // namespace base | 36 } // namespace base |
44 } // namespace v8 | 37 } // namespace v8 |
OLD | NEW |