diff --git a/include/swift/Basic/Algorithm.h b/include/swift/Basic/Algorithm.h deleted file mode 100644 index 55eacd94736..00000000000 --- a/include/swift/Basic/Algorithm.h +++ /dev/null @@ -1,35 +0,0 @@ -//===--- Algorithm.h - ------------------------------------------*- C++ -*-===// -// -// This source file is part of the Swift.org open source project -// -// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors -// Licensed under Apache License v2.0 with Runtime Library Exception -// -// See https://swift.org/LICENSE.txt for license information -// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -// -//===----------------------------------------------------------------------===// -// -// This file defines helper algorithms, some of which are ported from C++14, -// which may not be available on all platforms yet. -// -//===----------------------------------------------------------------------===// - -#ifndef SWIFT_BASIC_ALGORITHM_H -#define SWIFT_BASIC_ALGORITHM_H - -namespace swift { - /// Returns the minimum of `a` and `b`, or `a` if they are equivalent. - template - constexpr const T &min(const T &a, const T &b) { - return !(b < a) ? a : b; - } - - /// Returns the maximum of `a` and `b`, or `a` if they are equivalent. - template - constexpr const T &max(const T &a, const T &b) { - return (a < b) ? b : a; - } -} // end namespace swift - -#endif // SWIFT_BASIC_ALGORITHM_H diff --git a/include/swift/Basic/FlaggedPointer.h b/include/swift/Basic/FlaggedPointer.h index 5b5743d7421..f2cbe2720ae 100644 --- a/include/swift/Basic/FlaggedPointer.h +++ b/include/swift/Basic/FlaggedPointer.h @@ -17,13 +17,12 @@ #ifndef SWIFT_BASIC_FLAGGEDPOINTER_H #define SWIFT_BASIC_FLAGGEDPOINTER_H +#include #include #include "llvm/Support/Compiler.h" #include "llvm/Support/PointerLikeTypeTraits.h" -#include "Algorithm.h" - namespace swift { /// This class implements a pair of a pointer and boolean flag. @@ -170,7 +169,7 @@ public: enum { NumLowBitsAvailable = (BitPosition >= PtrTraits::NumLowBitsAvailable) ? PtrTraits::NumLowBitsAvailable - : (swift::min(int(BitPosition + 1), + : (std::min(int(BitPosition + 1), int(PtrTraits::NumLowBitsAvailable)) - 1) }; }; diff --git a/include/swift/Basic/PrefixMap.h b/include/swift/Basic/PrefixMap.h index 99ac3307a25..8faa92bd9f0 100644 --- a/include/swift/Basic/PrefixMap.h +++ b/include/swift/Basic/PrefixMap.h @@ -34,7 +34,6 @@ #ifndef SWIFT_BASIC_PREFIXMAP_H #define SWIFT_BASIC_PREFIXMAP_H -#include "swift/Basic/Algorithm.h" #include "swift/Basic/Debug.h" #include "swift/Basic/LLVM.h" #include "swift/Basic/type_traits.h" @@ -53,8 +52,8 @@ template class PrefixMapKeyPrinter; /// A map whose keys are sequences of comparable values, optimized for /// finding a mapped value for the longest matching initial subsequence. template ((sizeof(void*) - 1) / sizeof(KeyElementType), 1)> + size_t InlineKeyCapacity = std::max( + (sizeof(void *) - 1) / sizeof(KeyElementType), size_t(1))> class PrefixMap { public: using KeyType = ArrayRef;