r339044 - Fix for broken build on clang-hexagon-elf for ambiguous call to

Leonard Chan via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 6 12:31:01 PDT 2018


Author: leonardchan
Date: Mon Aug  6 12:31:00 2018
New Revision: 339044

URL: http://llvm.org/viewvc/llvm-project?rev=339044&view=rev
Log:
Fix for broken build on clang-hexagon-elf for ambiguous call to
std::abs.

Modified:
    cfe/trunk/lib/Basic/FixedPoint.cpp

Modified: cfe/trunk/lib/Basic/FixedPoint.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/FixedPoint.cpp?rev=339044&r1=339043&r2=339044&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/FixedPoint.cpp (original)
+++ cfe/trunk/lib/Basic/FixedPoint.cpp Mon Aug  6 12:31:00 2018
@@ -59,7 +59,8 @@ int APFixedPoint::compare(const APFixedP
   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);




More information about the cfe-commits mailing list