From: Leonard Chan Date: Mon, 6 Aug 2018 19:31:00 +0000 (+0000) Subject: Fix for broken build on clang-hexagon-elf for ambiguous call to X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cc18e9b17c9d2cbe4eb8a220e0686bafb445b825;p=clang Fix for broken build on clang-hexagon-elf for ambiguous call to std::abs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339044 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Basic/FixedPoint.cpp b/lib/Basic/FixedPoint.cpp index 58037ff398..bfff0fc212 100644 --- a/lib/Basic/FixedPoint.cpp +++ b/lib/Basic/FixedPoint.cpp @@ -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(getScale() - OtherScale)); + CommonWidth += getScale() >= OtherScale ? getScale() - OtherScale + : OtherScale - getScale(); ThisVal = ThisVal.extOrTrunc(CommonWidth); OtherVal = OtherVal.extOrTrunc(CommonWidth);