Skip to content

Commit ed0b773

Browse files
authored
[nfc] Fixed typos in comments in Sort.swift
There is still an incongruity between where `srcHigh` and `destHigh` are displayed in the diagram: `srcHigh` is shown at the location it logically represents, not its true position which is one past that, whereas `destHigh` (as well as `bufferHigh`) is shown at its true position (past the end) not at the location it logically represents. I am not sure if that is intentional.
1 parent 50fa6cf commit ed0b773

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

stdlib/public/core/Sort.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -400,13 +400,13 @@ internal func _merge<Element>(
400400
// After moving elements, the storage and buffer look like this, where
401401
// `x` is uninitialized memory:
402402
//
403-
// Storage: [4, 4, 7, 8, 9, 6, x, x, x, x, x]
404-
// ^ ^ ^
405-
// srcHigh destLow destHigh (past the end)
403+
// Storage: [4, 4, 7, 8, 9, 16, x, x, x, x, x]
404+
// ^ ^ ^
405+
// srcHigh destLow destHigh (past the end)
406406
//
407-
// Buffer: [8, 8, 10, 12, 15, x, ...]
408-
// ^ ^
409-
// bufferLow bufferHigh
407+
// Buffer: [8, 8, 10, 12, 15, x, ...]
408+
// ^ ^
409+
// bufferLow bufferHigh
410410
buffer.moveInitialize(from: mid, count: highCount)
411411
bufferHigh = bufferLow + highCount
412412

@@ -555,7 +555,7 @@ extension UnsafeMutableBufferPointer {
555555
// (a) - for all i in 2..<runs.count:
556556
// - runs[i - 2].count > runs[i - 1].count + runs[i].count
557557
// (b) - for c = runs.count - 1:
558-
// - runs[i - 1].count > runs[i].count
558+
// - runs[c - 1].count > runs[c].count
559559
//
560560
// Loop until the invariant is satisified for the top four elements of
561561
// `runs`. Because this method is called for every added run, and only

0 commit comments

Comments
 (0)