Skip to content

Commit c102f64

Browse files
committed
added lambda
1 parent bbb1bd8 commit c102f64

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

llvm/lib/Analysis/DemandedBits.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,17 @@ void DemandedBits::determineLiveOperandBits(
7777
}
7878
};
7979
auto GetShiftedRange = [&](unsigned Min, unsigned Max, bool ShiftLeft) {
80-
using ShiftFn = APInt (APInt::*)(unsigned) const;
81-
auto Shift = ShiftLeft ? static_cast<ShiftFn>(&APInt::shl)
82-
: static_cast<ShiftFn>(&APInt::lshr);
80+
auto ShiftF = [&](const APInt &Mask, unsigned ShiftAmnt) {
81+
return ShiftLeft ? Mask.shl(ShiftAmnt) : Mask.lshr(ShiftAmnt);
82+
};
8383
AB = APInt::getZero(BitWidth);
8484
uint8_t LoopRange = Max - Min;
8585
auto Mask = AOut;
8686
for (unsigned ShiftAmnt = 1; ShiftAmnt <= LoopRange; ShiftAmnt <<= 1) {
87-
APInt Shifted = (Mask.*Shift)(ShiftAmnt);
87+
APInt Shifted = ShiftF(Mask, ShiftAmnt);
8888
Mask |= Shifted;
8989
}
90-
AB = (Mask.*Shift)(Min);
90+
AB = ShiftF(Mask, Min);
9191
};
9292

9393
switch (UserI->getOpcode()) {

0 commit comments

Comments
 (0)