MethodImplOptions.AggressiveOptimization & MethodImplOptions.AggressiveInlining optimized. Small optimizations.
This commit is contained in:
1 parent
7a242b3bfa
commit
05d3061c47
23 files changed
+628
-559
No files matched your search
@@ -10,7 +10,7 @@ public sealed class PrimeTesterByLastDigit
|
||||
[ThreadStatic]
|
||||
private static bool _mod10Initialized;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
private static byte GetMod10(ulong value)
|
||||
{
|
||||
if (!_mod10Initialized || _mod10Stepper.Modulus != 10UL)
|
||||
@@ -24,6 +24,7 @@ public sealed class PrimeTesterByLastDigit
|
||||
return (byte)_mod10Stepper.Step(value);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization)]
|
||||
public static bool IsPrimeCpu(ulong n)
|
||||
{
|
||||
// The below IFs never trigger in production code of EvenPerfectBitScanner on --mersenne=bydivisor path.
|
||||
|
||||
Reference in new issue
Block a user