Various optimizations and cleanups. "in" removed from GpuUInt128 to avoid defensive copies from IL.

This commit is contained in:
mlemanczyk committed 2025-10-10 09:26:25 +02:00
1 parent 70eca5126b
commit ca0cadc8a3
18 files changed
+565 -395

No files matched your search

+6 -8
View File
@@ -218,7 +218,7 @@ public static class UInt128Extensions
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static bool IsBitSet(in GpuUInt128 value, int bitIndex)
private static bool IsBitSet(GpuUInt128 value, int bitIndex)
{
if (bitIndex >= 64)
{
@@ -229,18 +229,16 @@ public static class UInt128Extensions
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static ulong ExtractWindowValue(in GpuUInt128 exponent, int windowStart, int windowBitCount)
private static ulong ExtractWindowValue(GpuUInt128 exponent, int windowStart, int windowBitCount)
{
ulong mask = (1UL << windowBitCount) - 1UL;
if (windowStart != 0)
{
GpuUInt128 shifted = exponent;
shifted.ShiftRight(windowStart);
ulong mask = (1UL << windowBitCount) - 1UL;
return shifted.Low & mask;
exponent.ShiftRight(windowStart);
return exponent.Low & mask;
}
ulong directMask = (1UL << windowBitCount) - 1UL;
return exponent.Low & directMask;
return exponent.Low & mask;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]