Inline single-use modulo helpers

This commit is contained in:
Marek Lemańczyk committed 2025-09-22 19:54:54 +02:00
1 parent 3598f88aaf
commit 3b8a10a20b
5 files changed
+33 -35

No files matched your search

+2 -4
View File
@@ -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;
}
}
}