Go to the documentation of this file.
29 #include <gtest/gtest.h>
48 EXPECT_EQ(65536,
power(2, 16));
49 EXPECT_EQ(9765625,
power(5, 10));
85 EXPECT_DEATH_IF_SUPPORTED(
floorLog2(0),
"x > 0");
98 EXPECT_EQ(42,
ceilLog2(2821109907456));
105 EXPECT_EQ(90,
divCeil(7922, 89));
106 EXPECT_EQ(4,
divCeil(4800, 1442));
108 EXPECT_EQ(46,
divCeil(451, 10));
113 EXPECT_EQ(4104,
roundUp(4101, 4));
114 EXPECT_EQ(4112,
roundUp(4105, 8));
115 EXPECT_EQ(4112,
roundUp(4101, 16));
116 EXPECT_EQ(8192,
roundUp(7991, 256));
T roundDown(const T &val, const U &align)
This function is used to align addresses in memory.
T divCeil(const T &a, const U &b)
TEST(IntmathTest, isPowerOf2)
std::enable_if_t< std::is_integral< T >::value, int > floorLog2(T x)
T roundUp(const T &val, const U &align)
This function is used to align addresses in memory.
uint64_t power(uint32_t n, uint32_t e)
bool isPowerOf2(const T &n)
Generated on Tue Jun 22 2021 15:28:25 for gem5 by doxygen 1.8.17