Skip to content

Commit 6a18cb4

Browse files
committed
fixed min and max....
1 parent 7e43851 commit 6a18cb4

File tree

5 files changed

+1568
-460
lines changed

5 files changed

+1568
-460
lines changed

src/CountExceedingBehaviour.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
/// <summary>
44
/// Defines the behaviour of a split operation when there are more split instances than there may be.
5-
/// </summary>
5+
/// </summary>
66
public enum CountExceedingBehaviour
77
{
88
/// <summary>
@@ -11,7 +11,7 @@ public enum CountExceedingBehaviour
1111
AppendLastElements,
1212
/// <summary>
1313
/// Every split instance more than permitted will not be returned.
14-
/// </summary>
14+
/// </summary>
1515
CutLastElements
1616
}
1717
}

src/Enumerators/Split/SpanSplitWithCountEnumerator.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ namespace SpanExtensions.Enumerators
66
/// Supports iteration over a <see cref="ReadOnlySpan{T}"/> by splitting it a a specified delimiter of type <typeparamref name="T"/> with an upper limit of splits performed.
77
/// </summary>
88
/// <typeparam name="T">The type of elements in the enumerated <see cref="ReadOnlySpan{T}"/>.</typeparam>
9-
public ref struct SpanSplitWithCountEnumerator<T> where T : IEquatable<T>
9+
public ref struct SpanSplitWithCountEnumerator<T> where T : IEquatable<T>
1010
{
1111
ReadOnlySpan<T> Span;
1212
readonly T Delimiter;
1313
readonly int Count;
14-
readonly CountExceedingBehaviour CountExceedingBehaviour;
14+
readonly CountExceedingBehaviour CountExceedingBehaviour;
1515
int currentCount;
1616
bool enumerationDone;
1717
readonly int CountMinusOne;
@@ -68,18 +68,18 @@ public bool MoveNext()
6868
switch(CountExceedingBehaviour)
6969
{
7070
case CountExceedingBehaviour.CutLastElements:
71-
break;
71+
break;
7272
case CountExceedingBehaviour.AppendLastElements:
73-
if(currentCount == CountMinusOne)
73+
if(currentCount == CountMinusOne)
7474
{
75-
ReadOnlySpan<T> lower = span[..index];
76-
ReadOnlySpan<T> upper = span[(index + 1)..];
77-
Span<T> temp = new T[lower.Length + upper.Length];
78-
lower.CopyTo(temp[..index]);
75+
ReadOnlySpan<T> lower = span[..index];
76+
ReadOnlySpan<T> upper = span[(index + 1)..];
77+
Span<T> temp = new T[lower.Length + upper.Length];
78+
lower.CopyTo(temp[..index]);
7979
upper.CopyTo(temp[index..]);
80-
Current = temp;
80+
Current = temp;
8181
currentCount++;
82-
return true;
82+
return true;
8383
}
8484
break;
8585
default:

0 commit comments

Comments
 (0)