diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2013-05-24 22:58:37 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2013-05-24 22:58:37 +0000 |
commit | 3b77151a61d2985ad5b29ee3d05b34d553322c2a (patch) | |
tree | b05239e5cd11d93e3a6c7f96080b64de3bc0656c /unittests | |
parent | 4e505a47c76967ded5ec91acc25e7d0f9ac997c1 (diff) | |
download | external_llvm-3b77151a61d2985ad5b29ee3d05b34d553322c2a.zip external_llvm-3b77151a61d2985ad5b29ee3d05b34d553322c2a.tar.gz external_llvm-3b77151a61d2985ad5b29ee3d05b34d553322c2a.tar.bz2 |
[Support] Remove Count{Leading,Trailing}Zeros_{32,64}.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182690 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/Support/MathExtrasTest.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/unittests/Support/MathExtrasTest.cpp b/unittests/Support/MathExtrasTest.cpp index f3f32b7..93a38cb 100644 --- a/unittests/Support/MathExtrasTest.cpp +++ b/unittests/Support/MathExtrasTest.cpp @@ -52,6 +52,18 @@ TEST(MathExtras, countLeadingZeros) { EXPECT_EQ(10u, countLeadingZeros(NZ16)); EXPECT_EQ(26u, countLeadingZeros(NZ32)); EXPECT_EQ(58u, countLeadingZeros(NZ64)); + + EXPECT_EQ(8u, countLeadingZeros(0x00F000FFu)); + EXPECT_EQ(8u, countLeadingZeros(0x00F12345u)); + for (unsigned i = 0; i <= 30; ++i) { + EXPECT_EQ(31 - i, countLeadingZeros(1u << i)); + } + + EXPECT_EQ(8u, countLeadingZeros(0x00F1234500F12345ULL)); + EXPECT_EQ(1u, countLeadingZeros(1ULL << 62)); + for (unsigned i = 0; i <= 62; ++i) { + EXPECT_EQ(63 - i, countLeadingZeros(1ULL << i)); + } } TEST(MathExtras, findFirstSet) { @@ -129,22 +141,6 @@ TEST(MathExtras, ByteSwap_64) { EXPECT_EQ(0x1100FFEEDDCCBBAAULL, ByteSwap_64(0xAABBCCDDEEFF0011LL)); } -TEST(MathExtras, CountLeadingZeros_32) { - EXPECT_EQ(8u, CountLeadingZeros_32(0x00F000FF)); - EXPECT_EQ(8u, CountLeadingZeros_32(0x00F12345)); - for (unsigned i = 0; i <= 30; ++i) { - EXPECT_EQ(31 - i, CountLeadingZeros_32(1 << i)); - } -} - -TEST(MathExtras, CountLeadingZeros_64) { - EXPECT_EQ(8u, CountLeadingZeros_64(0x00F1234500F12345LL)); - EXPECT_EQ(1u, CountLeadingZeros_64(1LL << 62)); - for (unsigned i = 0; i <= 62; ++i) { - EXPECT_EQ(63 - i, CountLeadingZeros_64(1LL << i)); - } -} - TEST(MathExtras, CountLeadingOnes_32) { for (int i = 30; i >= 0; --i) { // Start with all ones and unset some bit. |