Restore GPU-backed UInt128 pow2 Montgomery helper

This commit is contained in:
Marek Lemańczyk committed 2025-10-05 02:13:31 +02:00
1 parent 7ffd438eee
commit 0bc97937aa
11 files changed
+1561 -30

No files matched your search

@@ -0,0 +1,29 @@
using BenchmarkDotNet.Attributes;
using PerfectNumbers.Core.Gpu;
namespace EvenPerfectBitScanner.Benchmarks;
[MemoryDiagnoser]
public class GpuRationalBenchmarks
{
private static readonly GpuRational Left = new(new GpuUInt128(3UL), new GpuUInt128(4UL));
private static readonly GpuRational Right = new(new GpuUInt128(5UL), new GpuUInt128(6UL));
private static readonly GpuUInt128 IntegerLeft = new(3UL);
private static readonly GpuUInt128 IntegerRight = new(5UL);
[Benchmark]
public GpuRational AddRational()
{
GpuRational value = Left;
value = value + Right;
return value;
}
[Benchmark]
public GpuUInt128 AddInteger()
{
GpuUInt128 value = IntegerLeft;
value.Add(IntegerRight);
return value;
}
}