summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/FixedPoint.cpp
diff options
context:
space:
mode:
authorLeonard Chan <leonardchan@google.com>2018-08-06 19:31:00 +0000
committerLeonard Chan <leonardchan@google.com>2018-08-06 19:31:00 +0000
commit7c4f4914e34a3844475deb5cc5a9fdd481361d3e (patch)
tree526c274e1135e3e02d9da9d0987a47cfe4266e97 /clang/lib/Basic/FixedPoint.cpp
parent10fd92dd941325d874762ba3fd5d2f0361b2d0b3 (diff)
downloadbcm5719-llvm-7c4f4914e34a3844475deb5cc5a9fdd481361d3e.tar.gz
bcm5719-llvm-7c4f4914e34a3844475deb5cc5a9fdd481361d3e.zip
Fix for broken build on clang-hexagon-elf for ambiguous call to
std::abs. llvm-svn: 339044
Diffstat (limited to 'clang/lib/Basic/FixedPoint.cpp')
-rw-r--r--clang/lib/Basic/FixedPoint.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Basic/FixedPoint.cpp b/clang/lib/Basic/FixedPoint.cpp
index 58037ff3983..bfff0fc212e 100644
--- a/clang/lib/Basic/FixedPoint.cpp
+++ b/clang/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<int>(getScale() - OtherScale));
+ CommonWidth += getScale() >= OtherScale ? getScale() - OtherScale
+ : OtherScale - getScale();
ThisVal = ThisVal.extOrTrunc(CommonWidth);
OtherVal = OtherVal.extOrTrunc(CommonWidth);
OpenPOWER on IntegriCloud