Skip to content

[nfc] Fixed typos in comments in Sort.swift #37892

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 16, 2021
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
14 changes: 7 additions & 7 deletions stdlib/public/core/Sort.swift
Original file line number Diff line number Diff line change
Expand Up @@ -400,13 +400,13 @@ internal func _merge<Element>(
// After moving elements, the storage and buffer look like this, where
// `x` is uninitialized memory:
//
// Storage: [4, 4, 7, 8, 9, 6, x, x, x, x, x]
// ^ ^ ^
// srcHigh destLow destHigh (past the end)
// Storage: [4, 4, 7, 8, 9, 16, x, x, x, x, x]
// ^ ^
// srcHigh/destLow destHigh (past the end)
//
// Buffer: [8, 8, 10, 12, 15, x, ...]
// ^ ^
// bufferLow bufferHigh
// Buffer: [8, 8, 10, 12, 15, x, ...]
// ^ ^
// bufferLow bufferHigh
buffer.moveInitialize(from: mid, count: highCount)
bufferHigh = bufferLow + highCount

Expand Down Expand Up @@ -555,7 +555,7 @@ extension UnsafeMutableBufferPointer {
// (a) - for all i in 2..<runs.count:
// - runs[i - 2].count > runs[i - 1].count + runs[i].count
// (b) - for c = runs.count - 1:
// - runs[i - 1].count > runs[i].count
// - runs[c - 1].count > runs[c].count
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

//
// Loop until the invariant is satisified for the top four elements of
// `runs`. Because this method is called for every added run, and only
Expand Down