Skip to content

Commit 0b36a33

Browse files
committed
Reland "[Support] Don't include <algorithm> in MathExtras.h"
This reverts commit af2a93f. This time, add the include to APInt.h, which apparently relied on getting this include transitively.
1 parent 9a6804a commit 0b36a33

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

llvm/include/llvm/ADT/APInt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include "llvm/Support/Compiler.h"
1919
#include "llvm/Support/MathExtras.h"
20+
#include <algorithm>
2021
#include <cassert>
2122
#include <climits>
2223
#include <cstring>

llvm/include/llvm/Support/MathExtras.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#define LLVM_SUPPORT_MATHEXTRAS_H
1515

1616
#include "llvm/Support/Compiler.h"
17-
#include <algorithm>
1817
#include <cassert>
1918
#include <climits>
2019
#include <cmath>
@@ -793,7 +792,7 @@ inline int64_t SignExtend64(uint64_t X, unsigned B) {
793792
/// value of the result.
794793
template <typename T>
795794
std::enable_if_t<std::is_unsigned<T>::value, T> AbsoluteDifference(T X, T Y) {
796-
return std::max(X, Y) - std::min(X, Y);
795+
return X > Y ? X - Y : Y - X;
797796
}
798797

799798
/// Add two unsigned integers, X and Y, of type T. Clamp the result to the

0 commit comments

Comments
 (0)