Skip to content

Commit

Permalink
Added Inclusive extension to int + aggressive Inlining
Browse files Browse the repository at this point in the history
  • Loading branch information
Simnico99 committed Jan 25, 2023
1 parent c39b538 commit 37eae92
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/ZirconNet.Core/Extensions/RangeExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using ZirconNet.Core.Runtime;
Expand All @@ -17,6 +18,7 @@ internal static CustomIntEnumerator GetEnumerator(this Range range)
return new CustomIntEnumerator(range);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
#if NETCOREAPP3_1_OR_GREATER
public static Range Inclusive(this Range range)
#else
Expand All @@ -25,4 +27,10 @@ internal static Range Inclusive(this Range range)
{
return new Range(range.Start, range.End.Value + 1);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int Inclusive(this int i)
{
return i + 1;
}
}

0 comments on commit 37eae92

Please sign in to comment.