Inline single-use modulo helpers
This commit is contained in:
1 parent
3598f88aaf
commit
3b8a10a20b
5 files changed
+33
-35
No files matched your search
@@ -241,9 +241,7 @@ public static class UInt128Extensions
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ulong Mod6(this UInt128 value)
|
||||
{
|
||||
ulong mod3 = value.Mod3();
|
||||
ulong key = (mod3 << 1) | ((ulong)value & 1UL);
|
||||
return key switch
|
||||
return ((value.Mod3() << 1) | ((ulong)value & 1UL)) switch
|
||||
{
|
||||
0UL => 0UL,
|
||||
1UL => 3UL,
|
||||
@@ -318,4 +316,4 @@ public static class UInt128Extensions
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user