Fix index type for bitfield. (#7541)

This commit is contained in:
Jiaming Yuan
2022-01-05 19:23:29 +08:00
committed by GitHub
parent 0df2ae63c7
commit 91c1a1c52f
2 changed files with 23 additions and 14 deletions

View File

@@ -38,6 +38,14 @@ TEST(BitField, Check) {
ASSERT_FALSE(bits.Check(i));
}
}
{
// regression test for correct index type.
std::vector<RBitField8::value_type> storage(33, 0);
storage[32] = static_cast<uint8_t>(1);
auto bits = RBitField8({storage.data(), storage.size()});
ASSERT_TRUE(bits.Check(256));
}
}
template <typename BitFieldT, typename VT = typename BitFieldT::value_type>