std::abs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339044
91177308-0d34-0410-b5e6-
96231b3b80d8
unsigned CommonWidth = std::max(Val.getBitWidth(), OtherWidth);
// Prevent overflow in the event the widths are the same but the scales differ
- CommonWidth += std::abs(static_cast<int>(getScale() - OtherScale));
+ CommonWidth += getScale() >= OtherScale ? getScale() - OtherScale
+ : OtherScale - getScale();
ThisVal = ThisVal.extOrTrunc(CommonWidth);
OtherVal = OtherVal.extOrTrunc(CommonWidth);