Skip to content

Commit b5d1c9f

Browse files
committed
Check to see if Val is 0 for ffs #160288
1 parent 8089053 commit b5d1c9f

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

clang/lib/AST/ByteCode/InterpBuiltin.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3185,9 +3185,7 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
31853185
return interp__builtin_elementwise_int_unaryop(
31863186
S, OpPC, Call, [](const APSInt &Val) {
31873187
return APInt(Val.getBitWidth(),
3188-
(Val.countTrailingZeros() == Val.getBitWidth())
3189-
? 0u
3190-
: (Val.countTrailingZeros() + 1u));
3188+
Val.isZero() ? 0u : Val.countTrailingZeros() + 1u);
31913189
});
31923190

31933191
case Builtin::BIaddressof:

0 commit comments

Comments
 (0)