Przeglądaj źródła

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

Leonard Chan 7 lat temu
rodzic
commit
cc18e9b17c
1 zmienionych plików z 2 dodań i 1 usunięć
  1. 2 1
      lib/Basic/FixedPoint.cpp

+ 2 - 1
lib/Basic/FixedPoint.cpp

@@ -59,7 +59,8 @@ int APFixedPoint::compare(const APFixedPoint &Other) const {
   unsigned CommonWidth = std::max(Val.getBitWidth(), OtherWidth);
   unsigned CommonWidth = std::max(Val.getBitWidth(), OtherWidth);
 
 
   // Prevent overflow in the event the widths are the same but the scales differ
   // 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);
   ThisVal = ThisVal.extOrTrunc(CommonWidth);
   OtherVal = OtherVal.extOrTrunc(CommonWidth);
   OtherVal = OtherVal.extOrTrunc(CommonWidth);