summaryrefslogtreecommitdiffstats
path: root/src/test/test_intarith.cc
diff options
context:
space:
mode:
authorKefu Chai <tchaikov@gmail.com>2022-08-21 18:37:59 +0200
committerKefu Chai <tchaikov@gmail.com>2022-08-22 12:03:59 +0200
commitb8dd567c54ba6926c4e5bacade81f310ea680613 (patch)
tree33e1489e5014df385b0cd3a48c8adb65eb374def /src/test/test_intarith.cc
parentcommon, test: use std::popcount() when appropriate (diff)
downloadceph-b8dd567c54ba6926c4e5bacade81f310ea680613.tar.xz
ceph-b8dd567c54ba6926c4e5bacade81f310ea680613.zip
include/intarith: drop popcount()
as it is not used anymore. Signed-off-by: Kefu Chai <tchaikov@gmail.com>
Diffstat (limited to 'src/test/test_intarith.cc')
-rw-r--r--src/test/test_intarith.cc19
1 files changed, 0 insertions, 19 deletions
diff --git a/src/test/test_intarith.cc b/src/test/test_intarith.cc
index d8943caf390..11bfbc6d156 100644
--- a/src/test/test_intarith.cc
+++ b/src/test/test_intarith.cc
@@ -58,22 +58,3 @@ TEST(intarith, p2family) {
ASSERT_EQ(0x1300, p2roundup(0x1234, 0x100));
ASSERT_EQ(0x5600, p2roundup(0x5600, 0x100));
}
-
-TEST(intarith, popcount) {
- // char, unsigned char
- EXPECT_EQ(0, popcount((char)(0)));
- EXPECT_EQ(1, popcount((unsigned char)(1)));
- // short, unsigned short
- EXPECT_EQ(1, popcount((short)0b10));
- EXPECT_EQ(2, popcount((unsigned char)(0b11U)));
- // int, unsigned int
- EXPECT_EQ(sizeof(int) * CHAR_BIT, popcount(-1));
- EXPECT_EQ(0, popcount(0));
- EXPECT_EQ(1, popcount(0b10U));
- // long, unsigned long
- EXPECT_EQ(1, popcount(0b1000'0000'0000'0000L));
- EXPECT_EQ(3, popcount(0b1100'1000'0000'0000UL));
- // long long, unsigned long long
- EXPECT_EQ(4, popcount(0x1111'0000LL));
- EXPECT_EQ(1, popcount(0x1000'0000ULL));
-}