summaryrefslogtreecommitdiff
path: root/lib/jxl/bits_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/jxl/bits_test.cc')
-rw-r--r--lib/jxl/bits_test.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/jxl/bits_test.cc b/lib/jxl/bits_test.cc
index bf5fa62..699090c 100644
--- a/lib/jxl/bits_test.cc
+++ b/lib/jxl/bits_test.cc
@@ -41,6 +41,10 @@ TEST(BitsTest, TestFloorLog2) {
EXPECT_EQ(expected[i - 1], FloorLog2Nonzero(uint64_t(i))) << " " << i;
}
+ EXPECT_EQ(11u, FloorLog2Nonzero(0x00000fffu)); // 4095
+ EXPECT_EQ(12u, FloorLog2Nonzero(0x00001000u)); // 4096
+ EXPECT_EQ(12u, FloorLog2Nonzero(0x00001001u)); // 4097
+
EXPECT_EQ(31u, FloorLog2Nonzero(0x80000000u));
EXPECT_EQ(31u, FloorLog2Nonzero(0x80000001u));
EXPECT_EQ(31u, FloorLog2Nonzero(0xFFFFFFFFu));
@@ -62,6 +66,10 @@ TEST(BitsTest, TestCeilLog2) {
EXPECT_EQ(expected[i - 1], CeilLog2Nonzero(uint64_t(i))) << " " << i;
}
+ EXPECT_EQ(12u, CeilLog2Nonzero(0x00000fffu)); // 4095
+ EXPECT_EQ(12u, CeilLog2Nonzero(0x00001000u)); // 4096
+ EXPECT_EQ(13u, CeilLog2Nonzero(0x00001001u)); // 4097
+
EXPECT_EQ(31u, CeilLog2Nonzero(0x80000000u));
EXPECT_EQ(32u, CeilLog2Nonzero(0x80000001u));
EXPECT_EQ(32u, CeilLog2Nonzero(0xFFFFFFFFu));