| 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 // Check all examples from table 10-1 of "Hacker's Delight". | 5 // Check all examples from table 10-1 of "Hacker's Delight". | 
| 6 | 6 | 
| 7 #include "src/base/division-by-constant.h" | 7 #include "src/base/division-by-constant.h" | 
| 8 | 8 | 
|  | 9 #include <stdint.h> | 
|  | 10 | 
| 9 #include <ostream>  // NOLINT | 11 #include <ostream>  // NOLINT | 
| 10 | 12 | 
| 11 #include "testing/gtest-support.h" | 13 #include "testing/gtest-support.h" | 
| 12 | 14 | 
| 13 namespace v8 { | 15 namespace v8 { | 
| 14 namespace base { | 16 namespace base { | 
| 15 | 17 | 
| 16 template <class T> | 18 template <class T> | 
| 17 std::ostream& operator<<(std::ostream& os, | 19 std::ostream& operator<<(std::ostream& os, | 
| 18                          const MagicNumbersForDivision<T>& mag) { | 20                          const MagicNumbersForDivision<T>& mag) { | 
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 123   EXPECT_EQ(M64(0xCCCCCCCCCCCCCCCDULL, 3, false), u64(10)); | 125   EXPECT_EQ(M64(0xCCCCCCCCCCCCCCCDULL, 3, false), u64(10)); | 
| 124   EXPECT_EQ(M64(0x2E8BA2E8BA2E8BA3ULL, 1, false), u64(11)); | 126   EXPECT_EQ(M64(0x2E8BA2E8BA2E8BA3ULL, 1, false), u64(11)); | 
| 125   EXPECT_EQ(M64(0xAAAAAAAAAAAAAAABULL, 3, false), u64(12)); | 127   EXPECT_EQ(M64(0xAAAAAAAAAAAAAAABULL, 3, false), u64(12)); | 
| 126   EXPECT_EQ(M64(0x47AE147AE147AE15ULL, 5, true), u64(25)); | 128   EXPECT_EQ(M64(0x47AE147AE147AE15ULL, 5, true), u64(25)); | 
| 127   EXPECT_EQ(M64(0x0624DD2F1A9FBE77ULL, 7, true), u64(125)); | 129   EXPECT_EQ(M64(0x0624DD2F1A9FBE77ULL, 7, true), u64(125)); | 
| 128   EXPECT_EQ(M64(0x346DC5D63886594BULL, 7, false), u64(625)); | 130   EXPECT_EQ(M64(0x346DC5D63886594BULL, 7, false), u64(625)); | 
| 129 } | 131 } | 
| 130 | 132 | 
| 131 }  // namespace base | 133 }  // namespace base | 
| 132 }  // namespace v8 | 134 }  // namespace v8 | 
| OLD | NEW | 
|---|