Skip to content

Commit 64606f6

Browse files
committed
fixed bug in Min()
1 parent 6df54d4 commit 64606f6

File tree

1 file changed

+11
-11
lines changed
  • src/Extensions/ReadOnlySpan/Linq

1 file changed

+11
-11
lines changed

src/Extensions/ReadOnlySpan/Linq/Min.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public static T Min<T>(this ReadOnlySpan<T> source) where T : IComparable<T>
177177
{
178178
T current = source[i];
179179

180-
if(current.CompareTo(min) > 0)
180+
if(current.CompareTo(min) < 0)
181181
{
182182
min = current;
183183
}
@@ -292,7 +292,7 @@ public static byte Min(this ReadOnlySpan<byte> source)
292292
{
293293
byte current = source[i];
294294

295-
if(current.CompareTo(min) > 0)
295+
if(current.CompareTo(min) < 0)
296296
{
297297
min = current;
298298
}
@@ -407,7 +407,7 @@ public static ushort Min(this ReadOnlySpan<ushort> source)
407407
{
408408
ushort current = source[i];
409409

410-
if(current.CompareTo(min) > 0)
410+
if(current.CompareTo(min) < 0)
411411
{
412412
min = current;
413413
}
@@ -522,7 +522,7 @@ public static uint Min(this ReadOnlySpan<uint> source)
522522
{
523523
uint current = source[i];
524524

525-
if(current.CompareTo(min) > 0)
525+
if(current.CompareTo(min) < 0)
526526
{
527527
min = current;
528528
}
@@ -606,7 +606,7 @@ public static ulong Min(this ReadOnlySpan<ulong> source)
606606
{
607607
ulong current = source[i];
608608

609-
if(current.CompareTo(min) > 0)
609+
if(current.CompareTo(min) < 0)
610610
{
611611
min = current;
612612
}
@@ -721,7 +721,7 @@ public static sbyte Min(this ReadOnlySpan<sbyte> source)
721721
{
722722
sbyte current = source[i];
723723

724-
if(current.CompareTo(min) > 0)
724+
if(current.CompareTo(min) < 0)
725725
{
726726
min = current;
727727
}
@@ -836,7 +836,7 @@ public static short Min(this ReadOnlySpan<short> source)
836836
{
837837
short current = source[i];
838838

839-
if(current.CompareTo(min) > 0)
839+
if(current.CompareTo(min) < 0)
840840
{
841841
min = current;
842842
}
@@ -951,7 +951,7 @@ public static int Min(this ReadOnlySpan<int> source)
951951
{
952952
int current = source[i];
953953

954-
if(current.CompareTo(min) > 0)
954+
if(current.CompareTo(min) < 0)
955955
{
956956
min = current;
957957
}
@@ -1035,7 +1035,7 @@ public static long Min(this ReadOnlySpan<long> source)
10351035
{
10361036
long current = source[i];
10371037

1038-
if(current.CompareTo(min) > 0)
1038+
if(current.CompareTo(min) < 0)
10391039
{
10401040
min = current;
10411041
}
@@ -1150,7 +1150,7 @@ public static float Min(this ReadOnlySpan<float> source)
11501150
{
11511151
float current = source[i];
11521152

1153-
if(current.CompareTo(min) > 0)
1153+
if(current.CompareTo(min) < 0)
11541154
{
11551155
min = current;
11561156
}
@@ -1234,7 +1234,7 @@ public static double Min(this ReadOnlySpan<double> source)
12341234
{
12351235
double current = source[i];
12361236

1237-
if(current.CompareTo(min) > 0)
1237+
if(current.CompareTo(min) < 0)
12381238
{
12391239
min = current;
12401240
}

0 commit comments

Comments
 (0)