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 <limits> | 5 #include <limits> |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/macros.h" | 8 #include "src/base/macros.h" |
9 #include "testing/gtest-support.h" | 9 #include "testing/gtest-support.h" |
10 | 10 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 TEST(Bits, SignedMulHighAndAdd32) { | 217 TEST(Bits, SignedMulHighAndAdd32) { |
218 TRACED_FORRANGE(int32_t, i, 1, 50) { | 218 TRACED_FORRANGE(int32_t, i, 1, 50) { |
219 EXPECT_EQ(i, SignedMulHighAndAdd32(0, 0, i)); | 219 EXPECT_EQ(i, SignedMulHighAndAdd32(0, 0, i)); |
220 TRACED_FORRANGE(int32_t, j, 1, i) { | 220 TRACED_FORRANGE(int32_t, j, 1, i) { |
221 EXPECT_EQ(i, SignedMulHighAndAdd32(j, j, i)); | 221 EXPECT_EQ(i, SignedMulHighAndAdd32(j, j, i)); |
222 } | 222 } |
223 EXPECT_EQ(i + 1, SignedMulHighAndAdd32(1024 * 1024 * 1024, 4, i)); | 223 EXPECT_EQ(i + 1, SignedMulHighAndAdd32(1024 * 1024 * 1024, 4, i)); |
224 } | 224 } |
225 } | 225 } |
226 | 226 |
227 | |
228 TEST(Bits, SignedMulHighAndSub32) { | |
229 TRACED_FORRANGE(int32_t, i, 1, 50) { | |
230 EXPECT_EQ(i, SignedMulHighAndSub32(0, 0, i)); | |
231 TRACED_FORRANGE(int32_t, j, 1, i) { | |
232 EXPECT_EQ(i, SignedMulHighAndSub32(j, j, i)); | |
233 } | |
234 EXPECT_EQ(i - 1, SignedMulHighAndSub32(1024 * 1024 * 1024, 4, i)); | |
235 } | |
236 } | |
237 | |
238 } // namespace bits | 227 } // namespace bits |
239 } // namespace base | 228 } // namespace base |
240 } // namespace v8 | 229 } // namespace v8 |
OLD | NEW |