Reland "[Support] Don't include <algorithm> in MathExtras.h"

This reverts commit af2a93fd6e.
This time, add the include to APInt.h, which apparently relied
on getting this include transitively.
This commit is contained in:
Nico Weber 2021-04-16 14:05:12 -04:00
parent 9a6804ab19
commit 0b36a33ab8
2 changed files with 2 additions and 2 deletions

View File

@ -17,6 +17,7 @@
#include "llvm/Support/Compiler.h"
#include "llvm/Support/MathExtras.h"
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstring>

View File

@ -14,7 +14,6 @@
#define LLVM_SUPPORT_MATHEXTRAS_H
#include "llvm/Support/Compiler.h"
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
@ -793,7 +792,7 @@ inline int64_t SignExtend64(uint64_t X, unsigned B) {
/// value of the result.
template <typename T>
std::enable_if_t<std::is_unsigned<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