forked from OSchip/llvm-project
[clang][Interp][NFC] Use constexpr if when possible in Integral.h
This commit is contained in:
parent
0da7e409e0
commit
651f4ce7b1
|
@ -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());
|
||||||
|
|
Loading…
Reference in New Issue