base: Remove duplicate isPow2 helper
This is already defined as isPowerOf2 in src/base/intmath.hh and it is currently unused Change-Id: I50b5d344e234fe1d4f1f85186686440773a209e3 Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/41533 Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -303,14 +303,6 @@ findLsbSet(uint64_t val)
|
||||
return lsb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a number is a power of two, or zero.
|
||||
*
|
||||
* @ingroup api_bitfield
|
||||
*/
|
||||
template <class T>
|
||||
constexpr inline bool isPow2(T v) { return (v & (v - 1)) == (T)0; }
|
||||
|
||||
/**
|
||||
* Returns the number of set ones in the provided value.
|
||||
* PD algorithm from
|
||||
|
||||
@@ -290,24 +290,6 @@ TEST(BitfieldTest, FindLsbZero)
|
||||
EXPECT_EQ(64, findLsbSet(0));
|
||||
}
|
||||
|
||||
/* The following tests a simple function that verifies whether a value is a
|
||||
* a power of two or not.
|
||||
*/
|
||||
TEST(BitfieldTest, IsPow2)
|
||||
{
|
||||
EXPECT_TRUE(isPow2(32));
|
||||
}
|
||||
|
||||
TEST(BitfieldTest, IsNotPow2)
|
||||
{
|
||||
EXPECT_FALSE(isPow2(36));
|
||||
}
|
||||
|
||||
TEST(BitfieldTest, IsPow2Zero)
|
||||
{
|
||||
EXPECT_TRUE(isPow2(0));
|
||||
}
|
||||
|
||||
/*
|
||||
* The following tests "popCount(X)". popCount counts the number of bits set to
|
||||
* one.
|
||||
|
||||
@@ -33,10 +33,12 @@
|
||||
TEST(IntmathTest, isPowerOf2)
|
||||
{
|
||||
EXPECT_TRUE(isPowerOf2(1));
|
||||
EXPECT_TRUE(isPowerOf2(32));
|
||||
EXPECT_TRUE(isPowerOf2(65536));
|
||||
EXPECT_TRUE(isPowerOf2(131072));
|
||||
EXPECT_TRUE(isPowerOf2(262144));
|
||||
EXPECT_FALSE(isPowerOf2(0));
|
||||
EXPECT_FALSE(isPowerOf2(36));
|
||||
EXPECT_FALSE(isPowerOf2(2521));
|
||||
EXPECT_FALSE(isPowerOf2(1679616));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user