mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-12-06 12:43:35 +01:00
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`).
This commit is contained in:
1 parent
c73fcc1530
commit
14d5fe714d
9 files changed
+41
-28
No files matched your search
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user