File tree Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -782,7 +782,8 @@ public func runAllTests() {
782
782
} else {
783
783
var runTestsInProcess : Bool = false
784
784
var filter : String ? = nil
785
- for var i = 0 ; i < Process . arguments. count; {
785
+ var i = 0
786
+ while i < Process . arguments. count {
786
787
let arg = Process . arguments [ i]
787
788
if arg == " --stdlib-unittest-in-process " {
788
789
runTestsInProcess = true
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ public struct _stdlib_ShardedAtomicCounter {
34
34
let hardwareConcurrency = _stdlib_getHardwareConcurrency ( )
35
35
let count = max ( 8 , hardwareConcurrency * hardwareConcurrency)
36
36
let shards = UnsafeMutablePointer< Int> . alloc( count)
37
- for var i = 0 ; i != count; i ++ {
37
+ for i in 0 ..< count {
38
38
( shards + i) . initialize ( 0 )
39
39
}
40
40
self . _shardsPtr = shards
@@ -57,7 +57,7 @@ public struct _stdlib_ShardedAtomicCounter {
57
57
var result = 0
58
58
let shards = self . _shardsPtr
59
59
let count = self . _shardsCount
60
- for var i = 0 ; i != count; i ++ {
60
+ for i in 0 ..< count {
61
61
result += _swift_stdlib_atomicLoadInt ( object: shards + i)
62
62
}
63
63
return result
@@ -72,7 +72,7 @@ public struct _stdlib_ShardedAtomicCounter {
72
72
73
73
public mutating func randomInt( ) -> Int {
74
74
var result = 0
75
- for var i = 0 ; i != Int . _sizeInBits; ++ i {
75
+ for _ in 0 ..< Int . _sizeInBits {
76
76
result = ( result << 1 ) | ( _state & 1 )
77
77
_state = ( _state >> 1 ) ^ ( - ( _state & 1 ) & Int ( bitPattern: 0xD0000001 ) )
78
78
}
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ public func scan<
43
43
44
44
public func randomShuffle< T> ( a: [ T ] ) -> [ T ] {
45
45
var result = a
46
- for var i = a. count - 1 ; i != 0 ; -- i {
46
+ for i in ( 1 ..< a. count) . reverse ( ) {
47
47
// FIXME: 32 bits are not enough in general case!
48
48
let j = Int ( rand32 ( exclusiveUpperBound: UInt32 ( i + 1 ) ) )
49
49
if i != j {
You can’t perform that action at this time.
0 commit comments