[stdlib] Change C-style for loop to Swift-style for-in loop

This commit is contained in:
JohnLui
2016-01-09 12:57:55 +08:00
parent 33ed1e0ab6
commit 451ce376e3
5 changed files with 24 additions and 17 deletions

View File

@@ -145,7 +145,7 @@ extension String.CharacterView : CollectionType {
unicodeScalars[start].value)
start._successorInPlace()
for ; start != end; start._successorInPlace() {
while start != end {
// FIXME(performance): consider removing this "fast path". A branch
// that is hard to predict could be worse for performance than a few
// loads from cache to fetch the property 'gcb1'.
@@ -158,6 +158,7 @@ extension String.CharacterView : CollectionType {
break
}
gcb0 = gcb1
start._successorInPlace()
}
return start._position - startIndexUTF16