mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-16 12:24:03 +00:00
[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
This commit is contained in:
@ -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.
|
||||
|
Reference in New Issue
Block a user