as it is not used anymore.
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
return (x + (1 << y) - 1) >> y;
}
-/*
- * Wrapper to determine if value is a power of 2
- */
-template<typename T>
-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.
}
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));