diff --git a/EvenPerfectBitScanner.Benchmarks/MulMod64Benchmarks.cs b/EvenPerfectBitScanner.Benchmarks/MulMod64Benchmarks.cs index e8fd914..c7cf190 100644 --- a/EvenPerfectBitScanner.Benchmarks/MulMod64Benchmarks.cs +++ b/EvenPerfectBitScanner.Benchmarks/MulMod64Benchmarks.cs @@ -40,6 +40,12 @@ public class MulMod64Benchmarks return MulMod64Inline(Input.Left, Input.Right, Input.Modulus); } + [Benchmark] + public ulong InlineUInt128OperandsWithReductionFirst() + { + return MulMod64InlineWithReductionFirst(Input.Left, Input.Right, Input.Modulus); + } + [Benchmark] public ulong InlineUInt128OperandsWithOperandReduction() { @@ -65,10 +71,10 @@ public class MulMod64Benchmarks } [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static ulong MulMod64Inline(ulong a, ulong b, ulong modulus) - { - return (ulong)(((UInt128)a * b) % modulus); - } + private static ulong MulMod64Inline(ulong a, ulong b, ulong modulus) => (ulong)(((UInt128)a * b) % modulus); + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static ulong MulMod64InlineWithReductionFirst(ulong a, ulong b, ulong modulus) => (ulong)(((UInt128)(a % modulus) * (b % modulus)) % modulus); [MethodImpl(MethodImplOptions.AggressiveInlining)] private static ulong MulMod64InlineWithOperandReduction(ulong a, ulong b, ulong modulus)