From 14d5fe714d5c270fdce4e8541b3903de3d5b2cff Mon Sep 17 00:00:00 2001 From: Martino Fontana Date: Sun, 15 Feb 2026 10:42:25 +0100 Subject: BitSet: Some small additions Also add requirements for using range functions. And micro-optimize testing if a bit is set (GCC and MSVC struggle to emit `bt` or `tbz`/`tbnz` with `bs & (1 << n)` compared to `(bs >> n) & 1`). --- Source/UnitTests/Common/BitSetTest.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Source/UnitTests/Common/BitSetTest.cpp') diff --git a/Source/UnitTests/Common/BitSetTest.cpp b/Source/UnitTests/Common/BitSetTest.cpp index 24937fdf4e..5423231514 100644 --- a/Source/UnitTests/Common/BitSetTest.cpp +++ b/Source/UnitTests/Common/BitSetTest.cpp @@ -18,13 +18,15 @@ TEST(BitSet, Basics) EXPECT_EQ(bs2, bs2); EXPECT_NE(bs2, bs3); EXPECT_EQ(BitSet32(0xfff), BitSet32::AllTrue(12)); - EXPECT_EQ(BitSet64(0xffffffffffffffff), BitSet64::AllTrue(64)); + EXPECT_EQ(BitSet64(0xffffffffffffffff), BitSet64::AllTrue()); } TEST(BitSet, BitGetSet) { BitSet32 bs; - bs[3] = bs[8] = bs[11] = true; + bs[3] = true; + bs[8] = true; + bs[11] = true; EXPECT_TRUE(bs[3]); EXPECT_FALSE(bs[4]); EXPECT_EQ((u32)((1 << 3) | (1 << 8) | (1 << 11)), bs.m_val); -- cgit v1.2.3