@@ -49,6 +49,21 @@ public static T Sum<T>(this Span<T> source) where T : INumber<T>
4949 return ReadOnlySpanExtensions . Sum < T > ( source ) ;
5050 }
5151#else
52+
53+ #if NET5_0_OR_GREATER
54+
55+ /// <summary>
56+ /// Computes the Sum of all the elements in <paramref name="source"/>.
57+ /// </summary>
58+ /// <param name="source">The <see cref="Span{Half}"/> to operate on.</param>
59+ /// <returns>The Sum of all the elements in <paramref name="source"/>.</returns>
60+ /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
61+ public static Half Sum ( this Span < Half > source )
62+ {
63+ return ReadOnlySpanExtensions . Sum ( source ) ;
64+ }
65+ #endif
66+
5267 /// <summary>
5368 /// Computes the Sum of all the elements in <paramref name="source"/>.
5469 /// </summary>
@@ -181,20 +196,6 @@ public static BigInteger Sum(this Span<BigInteger> source)
181196 }
182197#endif
183198
184- #if NET5_0_OR_GREATER
185-
186- /// <summary>
187- /// Computes the Sum of all the elements in <paramref name="source"/>.
188- /// </summary>
189- /// <param name="source">The <see cref="Span{Half}"/> to operate on.</param>
190- /// <returns>The Sum of all the elements in <paramref name="source"/>.</returns>
191- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
192- public static Half Sum ( this Span < Half > source )
193- {
194- return ReadOnlySpanExtensions . Sum ( source ) ;
195- }
196- #endif
197-
198199 /// <summary>
199200 /// Bypasses a specified number of elements in <paramref name="source"/> and then returns the remaining elements.
200201 /// </summary>
@@ -329,6 +330,7 @@ public static Half Average(this Span<Half> source)
329330 return ReadOnlySpanExtensions . Average ( source ) ;
330331 }
331332#endif
333+
332334 /// <summary>
333335 /// Computes the Average of all the values in <paramref name="source"/>.
334336 /// </summary>
@@ -460,6 +462,7 @@ public static BigInteger Average(this Span<BigInteger> source)
460462 return ReadOnlySpanExtensions . Average ( source ) ;
461463 }
462464#endif
465+
463466#if NET7_0_OR_GREATER
464467
465468 /// <summary>
@@ -488,6 +491,7 @@ public static Half Min(this Span<Half> source)
488491 return ReadOnlySpanExtensions . Min ( source ) ;
489492 }
490493#endif
494+
491495 /// <summary>
492496 /// Computes the Min of all the values in <paramref name="source"/>.
493497 /// </summary>
@@ -619,6 +623,7 @@ public static BigInteger Min(this Span<BigInteger> source)
619623 return ReadOnlySpanExtensions . Min ( source ) ;
620624 }
621625#endif
626+
622627#if NET7_0_OR_GREATER
623628
624629 /// <summary>
@@ -647,6 +652,7 @@ public static Half Max(this Span<Half> source)
647652 return ReadOnlySpanExtensions . Max ( source ) ;
648653 }
649654#endif
655+
650656 /// <summary>
651657 /// Computes the Max of all the values in <paramref name="source"/>.
652658 /// </summary>
@@ -778,6 +784,5 @@ public static BigInteger Max(this Span<BigInteger> source)
778784 return ReadOnlySpanExtensions . Max ( source ) ;
779785 }
780786#endif
781-
782787 }
783788}
0 commit comments