void add_check <T>() where T : unmanaged { var asmop = AsmOps.Add <T>(); for (var i = 0; i < SampleSize; i++) { var a = Random.Next <T>(); var b = Random.Next <T>(); var expect = gmath.add(a, b); var actual = asmop(a, b); Claim.eq(expect, actual); } }
void add_bench <T>(SystemCounter subject = default, SystemCounter compare = default) where T : unmanaged { var last = default(T); var asmop = AsmOps.Add <T>(); for (var i = 0; i < OpCount; i++) { var a = Random.Next <T>(); var b = Random.Next <T>(); subject.Start(); last = asmop(a, b); subject.Stop(); compare.Start(); last = gmath.add(a, b); compare.Stop(); } Benchmark($"add{moniker<T>()}_asm", subject); Benchmark($"add{moniker<T>()}", compare); }
public void add64f_check() => VerifyOp(AsmOps.Add <double>(), fmath.add);
public void add64u_check() => VerifyOp(AsmOps.Add <ulong>(), math.add);
public void add32u_check() => VerifyOp(AsmOps.Add <uint>(), math.add);
public void add16u_check() => VerifyOp(AsmOps.Add <ushort>(), math.add);
public void add8u_check() => VerifyOp(AsmOps.Add <byte>(), math.add);