Details
Details
- Reviewers
courbet - Commits
- rG4c0a965c0926: Fix off by one error in Bitfields
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
I'll add the following test as a separate commit if it LGTY.
Note: I can't use EXPECT_EQ because it takes the arguments by const & and the properties are static constexpr, the compiler complains about undefined reference.
TEST(BitfieldsTest, Properties) { using A = Bitfield::Element<bool, 0, 1>; EXPECT_TRUE(A::FirstBit == 0U); EXPECT_TRUE(A::LastBit == 0U); EXPECT_TRUE(A::Shift == 0U); EXPECT_TRUE(A::Bits == 1U); using B = Bitfield::Element<unsigned, 3, 4>; EXPECT_TRUE(B::FirstBit == 3U); EXPECT_TRUE(B::LastBit == 6U); EXPECT_TRUE(B::Shift == 3U); EXPECT_TRUE(B::Bits == 4U); }