Implement GPU pow2 heuristics with safe fallbacks

This commit is contained in:
Marek Lemańczyk committed 2025-10-04 22:40:12 +02:00
1 parent ea08d3f71f
commit 38df505f4f
5 files changed
+123 -50

No files matched your search

+11
View File
@@ -56,6 +56,17 @@ public static class ULongExtensions
return order;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int GetBitLength(this ulong value)
{
if (value == 0UL)
{
return 0;
}
return 64 - BitOperations.LeadingZeroCount(value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static ulong MultiplyShiftRight(ulong value, ulong multiplier, int shift)
{