Skip to content

Commit af2a93f

Browse files
committed
Revert "[Support] Don't include <algorithm> in MathExtras.h"
This reverts commit 6580d8a.
1 parent 7cc4a02 commit af2a93f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/include/llvm/Support/MathExtras.h

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

1616
#include "llvm/Support/Compiler.h"
17+
#include <algorithm>
1718
#include <cassert>
1819
#include <climits>
1920
#include <cmath>
@@ -792,7 +793,7 @@ inline int64_t SignExtend64(uint64_t X, unsigned B) {
792793
/// value of the result.
793794
template <typename T>
794795
std::enable_if_t<std::is_unsigned<T>::value, T> AbsoluteDifference(T X, T Y) {
795-
return X > Y ? X - Y : Y - X;
796+
return std::max(X, Y) - std::min(X, Y);
796797
}
797798

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

0 commit comments

Comments
 (0)