|
|
|
@ -11,33 +11,6 @@ namespace SixLabors.ImageSharp.Common |
|
|
|
/// </summary>
|
|
|
|
internal static class EnumerableExtensions |
|
|
|
{ |
|
|
|
/// <summary>
|
|
|
|
/// Generates a sequence of integral numbers within a specified range.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="fromInclusive">
|
|
|
|
/// The start index, inclusive.
|
|
|
|
/// </param>
|
|
|
|
/// <param name="toExclusive">
|
|
|
|
/// The end index, exclusive.
|
|
|
|
/// </param>
|
|
|
|
/// <param name="step">
|
|
|
|
/// The incremental step.
|
|
|
|
/// </param>
|
|
|
|
/// <returns>
|
|
|
|
/// The <see cref="IEnumerable{Int32}"/> that contains a range of sequential integral numbers.
|
|
|
|
/// </returns>
|
|
|
|
public static IEnumerable<int> SteppedRange(int fromInclusive, int toExclusive, int step) |
|
|
|
{ |
|
|
|
// Borrowed from Enumerable.Range
|
|
|
|
long num = (fromInclusive + toExclusive) - 1L; |
|
|
|
if ((toExclusive < 0) || (num > 0x7fffffffL)) |
|
|
|
{ |
|
|
|
throw new ArgumentOutOfRangeException(nameof(toExclusive)); |
|
|
|
} |
|
|
|
|
|
|
|
return RangeIterator(fromInclusive, i => i < toExclusive, step); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Generates a sequence of integral numbers within a specified range.
|
|
|
|
/// </summary>
|
|
|
|
|