]> granicus.if.org Git - clang/commitdiff
Fix for broken build on clang-hexagon-elf for ambiguous call to
authorLeonard Chan <leonardchan@google.com>
Mon, 6 Aug 2018 19:31:00 +0000 (19:31 +0000)
committerLeonard Chan <leonardchan@google.com>
Mon, 6 Aug 2018 19:31:00 +0000 (19:31 +0000)
std::abs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339044 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/FixedPoint.cpp

index 58037ff39834a5e42b058abce9a39a730ed324ea..bfff0fc212e0a63b83fa3ff5485f3599e816d670 100644 (file)
@@ -59,7 +59,8 @@ int APFixedPoint::compare(const APFixedPoint &Other) const {
   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);