[llvm] [ADT] Bitset: add shift operators, word accessors, and etc (PR #193400)
Jiachen Yuan via llvm-commits
llvm-commits at lists.llvm.org
Sun May 3 16:01:18 PDT 2026
================
@@ -194,6 +194,95 @@ template <unsigned NumBits> class Bitset {
}
return false;
}
+
+ constexpr Bitset &operator<<=(unsigned N) {
+ if (N == 0)
+ return *this;
+ if (N >= NumBits) {
+ return *this = Bitset();
+ }
+ const unsigned WordShift = N / BitwordBits;
+ const unsigned BitShift = N % BitwordBits;
+ if (BitShift == 0) {
+ for (int I = NumWords - 1; I >= static_cast<int>(WordShift); --I)
----------------
JiachenYuan wrote:
Thank you! I have updated to use the proposed way of writing the loops.
https://github.com/llvm/llvm-project/pull/193400
More information about the llvm-commits
mailing list