File tree Expand file tree Collapse file tree
Sources/Falko.Common.Sequences/Sequences Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,11 +11,12 @@ public ref struct ValueEnumerator
1111
1212 private readonly int _valuesCount ;
1313
14- private int _currentIndex = - 1 ;
14+ private int _currentIndex ;
1515
1616 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
1717 internal ValueEnumerator ( T [ ] values , int valuesCount )
1818 {
19+ _currentIndex = - 1 ;
1920 _valuesReference = ref MemoryMarshal . GetArrayDataReference ( values ) ;
2021 _valuesCount = valuesCount ;
2122 }
@@ -29,7 +30,15 @@ public ref readonly T Current
2930 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
3031 public bool MoveNext ( )
3132 {
32- return ++ _currentIndex < _valuesCount ;
33+ var index = _currentIndex + 1 ;
34+
35+ if ( index < _valuesCount )
36+ {
37+ _currentIndex = index ;
38+ return true ;
39+ }
40+
41+ return false ;
3342 }
3443
3544 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
You can’t perform that action at this time.
0 commit comments