We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 55f7d76 + f725352 commit eaea1c6Copy full SHA for eaea1c6
stdlib/public/core/Index.swift
@@ -288,8 +288,10 @@ extension BidirectionalIndexType {
288
return _advanceForward(n)
289
}
290
var p = self
291
- for var i: Distance = n; i != 0; ++i {
292
- --p
+ var i: Distance = n
+ while i != 0 {
293
+ p._predecessorInPlace()
294
+ i._successorInPlace()
295
296
return p
297
@@ -300,8 +302,10 @@ extension BidirectionalIndexType {
300
302
return _advanceForward(n, limit)
301
303
304
- for var i: Distance = n; i != 0 && p != limit; ++i {
305
306
+ while i != 0 && p != limit {
307
308
309
310
311
0 commit comments