aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/intmath.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zencore/intmath.cpp')
-rw-r--r--src/zencore/intmath.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/zencore/intmath.cpp b/src/zencore/intmath.cpp
index 5a686dc8e..fedf76edc 100644
--- a/src/zencore/intmath.cpp
+++ b/src/zencore/intmath.cpp
@@ -19,6 +19,8 @@ intmath_forcelink()
{
}
+TEST_SUITE_BEGIN("core.intmath");
+
TEST_CASE("intmath")
{
CHECK(FloorLog2(0x00) == 0);
@@ -43,6 +45,12 @@ TEST_CASE("intmath")
CHECK(FloorLog2_64(0x0000'0001'0000'0000ull) == 32);
CHECK(FloorLog2_64(0x8000'0000'0000'0000ull) == 63);
+ CHECK(CountLeadingZeros(0x8000'0000u) == 0);
+ CHECK(CountLeadingZeros(0x0000'0000u) == 32);
+ CHECK(CountLeadingZeros(0x0000'0001u) == 31);
+ CHECK(CountLeadingZeros(0x0000'8000u) == 16);
+ CHECK(CountLeadingZeros(0x0001'0000u) == 15);
+
CHECK(CountLeadingZeros64(0x8000'0000'0000'0000ull) == 0);
CHECK(CountLeadingZeros64(0x0000'0000'0000'0000ull) == 64);
CHECK(CountLeadingZeros64(0x0000'0000'0000'0001ull) == 63);
@@ -60,6 +68,8 @@ TEST_CASE("intmath")
CHECK(ByteSwap(uint64_t(0x214d'6172'7469'6e21ull)) == 0x216e'6974'7261'4d21ull);
}
+TEST_SUITE_END();
+
#endif
} // namespace zen