From 0b36a33ab89488a631d5ee9580904a36898c7954 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Fri, 16 Apr 2021 14:05:12 -0400 Subject: [PATCH] Reland "[Support] Don't include in MathExtras.h" This reverts commit af2a93fd6e9f9e037d2e2d67b879fe85d7e1cbed. This time, add the include to APInt.h, which apparently relied on getting this include transitively. --- llvm/include/llvm/ADT/APInt.h | 1 + llvm/include/llvm/Support/MathExtras.h | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h index b97ea2cd9aee..0fca6bac43fd 100644 --- a/llvm/include/llvm/ADT/APInt.h +++ b/llvm/include/llvm/ADT/APInt.h @@ -17,6 +17,7 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/MathExtras.h" +#include #include #include #include diff --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h index 640b3a11ce6c..10d4260a7eb1 100644 --- a/llvm/include/llvm/Support/MathExtras.h +++ b/llvm/include/llvm/Support/MathExtras.h @@ -14,7 +14,6 @@ #define LLVM_SUPPORT_MATHEXTRAS_H #include "llvm/Support/Compiler.h" -#include #include #include #include @@ -793,7 +792,7 @@ inline int64_t SignExtend64(uint64_t X, unsigned B) { /// value of the result. template std::enable_if_t::value, T> AbsoluteDifference(T X, T Y) { - return std::max(X, Y) - std::min(X, Y); + return X > Y ? X - Y : Y - X; } /// Add two unsigned integers, X and Y, of type T. Clamp the result to the