From 275ec55c952c257945e61c981ce150e2b85d5e4f Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 22 Aug 2022 00:30:34 +0800 Subject: [PATCH] include/intarith: drop isp2() as it is not used anymore. Signed-off-by: Kefu Chai --- src/include/intarith.h | 8 -------- src/test/test_intarith.cc | 3 --- 2 files changed, 11 deletions(-) diff --git a/src/include/intarith.h b/src/include/intarith.h index d3eaff15635..281aa8b3349 100644 --- a/src/include/intarith.h +++ b/src/include/intarith.h @@ -33,14 +33,6 @@ constexpr inline std::make_unsigned_t> shift_round_up(T return (x + (1 << y) - 1) >> y; } -/* - * Wrapper to determine if value is a power of 2 - */ -template -constexpr inline bool isp2(T x) { - return (x & (x - 1)) == 0; -} - /* * Wrappers for various sorts of alignment and rounding. The "align" must * be a power of 2. Often times it is a block, sector, or page. diff --git a/src/test/test_intarith.cc b/src/test/test_intarith.cc index c7dae7a7dcd..bb01343d4d1 100644 --- a/src/test/test_intarith.cc +++ b/src/test/test_intarith.cc @@ -62,9 +62,6 @@ TEST(intarith, ctz) { } TEST(intarith, p2family) { - ASSERT_TRUE(isp2(0x100)); - ASSERT_FALSE(isp2(0x1234)); - ASSERT_EQ(1024, p2align(1200, 1024)); ASSERT_EQ(1024, p2align(1024, 1024)); ASSERT_EQ(0x1200, p2align(0x1234, 0x100)); -- 2.39.5