[stdlib] revert r18764.

Swift SVN r18765
This commit is contained in:
Manman Ren
2014-06-10 00:13:41 +00:00
parent cc90c81239
commit aec78d0693
6 changed files with 8 additions and 16 deletions

View File

@@ -312,14 +312,6 @@ func min<T : Comparable>(x: T, y: T, rest: T...) -> T {
return r
}
func max2<T : Comparable>(x: T, y: T) -> T {
var r = y
if y < x {
r = x
}
return r
}
func max<T : Comparable>(x: T, y: T, rest: T...) -> T {
var r = y
if y < x {

View File

@@ -507,7 +507,7 @@ where C.GeneratorType.Element == A._Buffer.Element
// Ensure uniqueness, mutability, and sufficient storage. Note that
// for consistency, we need unique lhs even if rhs is empty.
lhs.reserveCapacity(
newCount > capacity ? max2(newCount, capacity * 2) : newCount)
newCount > capacity ? max(newCount, capacity * 2) : newCount)
var p = lhs._buffer.elementStorage + oldCount
for x in rhs {
@@ -541,14 +541,14 @@ func _demandUniqueMutableBuffer<_Buffer: ArrayBufferType>(
_sanityCheck(newCount >= 0)
let requiredCapacity = max2(newCount, minimumCapacity)
let requiredCapacity = max(newCount, minimumCapacity)
if let b = source.requestUniqueMutableBuffer(requiredCapacity) {
source.count = newCount
return nil
}
let minimumCapacity = max2(
let minimumCapacity = max(
requiredCapacity,
newCount > source.capacity ? source.capacity * 2 : source.capacity)

View File

@@ -57,7 +57,7 @@ struct ContiguousArrayBuffer<T> : ArrayBufferType, LogicValue {
_base = HeapBuffer(
ContiguousArrayStorage<T>.self,
_ArrayBody(),
max2(count, minimumCapacity))
max(count, minimumCapacity))
var bridged = false
if _canBeClass(T.self) {

View File

@@ -405,7 +405,7 @@ struct _NativeDictionaryStorage<KeyType : Hashable, ValueType> :
static func getMinCapacity(
requestedCount: Int, _ maxLoadFactorInverse: Double) -> Int {
// `requestedCount + 1` below ensures that we don't fill in the last hole
return max2(Int(Double(requestedCount) * maxLoadFactorInverse),
return max(Int(Double(requestedCount) * maxLoadFactorInverse),
requestedCount + 1)
}

View File

@@ -90,7 +90,7 @@ struct _StringBuffer {
// Allocate storage
self = _StringBuffer(
capacity: max2(utf16Count, minimumCapacity),
capacity: max(utf16Count, minimumCapacity),
initialSize: utf16Count,
elementWidth: isAscii ? 1 : 2)

View File

@@ -339,7 +339,7 @@ struct _StringCore {
}
else if newSize > buffer.capacity {
// Growth failed because of insufficient storage; double the size
return (max2(buffer.capacity * 2, newSize), .null())
return (max(buffer.capacity * 2, newSize), .null())
}
}
return (newSize, .null())