Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Sources/Algorithms/MinMax.swift
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,14 @@ extension Collection {
"""
)

// Make sure we are within bounds.
let prefixCount = Swift.min(count, self.count)

// Do nothing if we're prefixing nothing.
guard count > 0 else {
guard prefixCount > 0 else {
return []
}

// Make sure we are within bounds.
let prefixCount = Swift.min(count, self.count)

// If we're attempting to prefix more than 10% of the collection, it's
// faster to sort everything.
guard prefixCount < (self.count / 10) else {
Expand Down Expand Up @@ -310,14 +310,14 @@ extension Collection {
"""
)

// Make sure we are within bounds.
let suffixCount = Swift.min(count, self.count)

// Do nothing if we're suffixing nothing.
guard count > 0 else {
guard suffixCount > 0 else {
return []
}

// Make sure we are within bounds.
let suffixCount = Swift.min(count, self.count)

// If we're attempting to prefix more than 10% of the collection, it's
// faster to sort everything.
guard suffixCount < (self.count / 10) else {
Expand Down