summaryrefslogtreecommitdiff
path: root/Source/UnitTests/Common/MathUtilTest.cpp
diff options
context:
space:
mode:
authorLéo Lam <leo@innovatetechnologi.es>2018-05-11 10:16:29 +0200
committerGitHub <noreply@github.com>2018-05-11 10:16:29 +0200
commit066e4ea463789363d9d5b0c0568773a664461d82 (patch)
tree103842c9707aa0c946f4cf631114826d10b2a537 /Source/UnitTests/Common/MathUtilTest.cpp
parent2b8d69f476300c01a03695cb51515eff3e2208b9 (diff)
parentba01f6dba3cf1858ed64bc7f1abee744ffd313ec (diff)
Merge pull request #6809 from lioncash/macro
CommonFuncs: Convert ROUND_UP_POW2 macro to a function
Diffstat (limited to 'Source/UnitTests/Common/MathUtilTest.cpp')
-rw-r--r--Source/UnitTests/Common/MathUtilTest.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/Source/UnitTests/Common/MathUtilTest.cpp b/Source/UnitTests/Common/MathUtilTest.cpp
index 4b21ace1c4..2b808e7be5 100644
--- a/Source/UnitTests/Common/MathUtilTest.cpp
+++ b/Source/UnitTests/Common/MathUtilTest.cpp
@@ -30,3 +30,11 @@ TEST(MathUtil, IntLog2)
EXPECT_EQ(3, IntLog2(15));
EXPECT_EQ(63, IntLog2(0xFFFFFFFFFFFFFFFFull));
}
+
+TEST(MathUtil, NextPowerOf2)
+{
+ EXPECT_EQ(4, MathUtil::NextPowerOf2(3));
+ EXPECT_EQ(4, MathUtil::NextPowerOf2(4));
+ EXPECT_EQ(8, MathUtil::NextPowerOf2(6));
+ EXPECT_EQ(0x40000000, MathUtil::NextPowerOf2(0x23456789));
+}