| 113 | return count; |
| 114 | } |
| 115 | |
| 116 | TEST_F(BitUtilTest, countBits) { |
| 117 | uint64_t data[] = { |
| 118 | 0xff00ff00ffff00ff, |
| 119 | 0x0f0f0f0f0f0f0f0f, |
| 120 | 0xfedcba9876543210, |
| 121 | 0xf0f0f0f0f0f0f0f0, |
| 122 | 0x0123456789abcdef}; |
| 123 | // We drop one high bit and one low bit on every round. |
| 124 | int32_t totalBits = sizeof(data) * 8; |
| 125 | for (int32_t i = 0; i < 10 + (totalBits / 2); ++i) { |
| 126 | EXPECT_EQ( |
| 127 | countBits(data, i, totalBits - i), |
| 128 | simpleCountBits(data, i, totalBits - i)); |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | TEST_F(BitUtilTest, reverseBits) { |
nothing calls this directly
no test coverage detected