Implement GPU pow2 heuristics with safe fallbacks
This commit is contained in:
1 parent
ea08d3f71f
commit
38df505f4f
5 files changed
+123
-50
No files matched your search
@@ -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)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user