From cc18e9b17c9d2cbe4eb8a220e0686bafb445b825 Mon Sep 17 00:00:00 2001 From: Leonard Chan Date: Mon, 6 Aug 2018 19:31:00 +0000 Subject: [PATCH] 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 --- lib/Basic/FixedPoint.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); -- 2.50.1