[clang][Interp][NFC] Use constexpr if when possible in Integral.h

This commit is contained in:
Timm Bäder 2022-09-06 09:34:23 +02:00
parent 0da7e409e0
commit 651f4ce7b1
1 changed files with 2 additions and 2 deletions

View File

@ -107,7 +107,7 @@ public:
return APSInt(APInt(Bits, static_cast<uint64_t>(V), Signed), !Signed); return APSInt(APInt(Bits, static_cast<uint64_t>(V), Signed), !Signed);
} }
APSInt toAPSInt(unsigned NumBits) const { APSInt toAPSInt(unsigned NumBits) const {
if (Signed) if constexpr (Signed)
return APSInt(toAPSInt().sextOrTrunc(NumBits), !Signed); return APSInt(toAPSInt().sextOrTrunc(NumBits), !Signed);
else else
return APSInt(toAPSInt().zextOrTrunc(NumBits), !Signed); return APSInt(toAPSInt().zextOrTrunc(NumBits), !Signed);
@ -171,7 +171,7 @@ public:
} }
template <bool SrcSign> static Integral from(Integral<0, SrcSign> Value) { template <bool SrcSign> static Integral from(Integral<0, SrcSign> Value) {
if (SrcSign) if constexpr (SrcSign)
return Integral(Value.V.getSExtValue()); return Integral(Value.V.getSExtValue());
else else
return Integral(Value.V.getZExtValue()); return Integral(Value.V.getZExtValue());