File tree Expand file tree Collapse file tree 1 file changed +2
-6
lines changed
src/libraries/System.Private.CoreLib/src/System/Numerics Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -389,12 +389,8 @@ private static int Log2SoftwareFallback(uint value)
389
389
value |= value >> 08 ;
390
390
value |= value >> 16 ;
391
391
392
- // uint.MaxValue >> 27 is always in range [0 - 31] so we use Unsafe.AddByteOffset to avoid bounds check
393
- return Unsafe . AddByteOffset (
394
- // Using deBruijn sequence, k=2, n=5 (2^5=32) : 0b_0000_0111_1100_0100_1010_1100_1101_1101u
395
- ref MemoryMarshal . GetReference ( Log2DeBruijn ) ,
396
- // uint|long -> IntPtr cast on 32-bit platforms does expensive overflow checks not needed here
397
- ( IntPtr ) ( int ) ( ( value * 0x07C4ACDDu ) >> 27 ) ) ;
392
+ // Using deBruijn sequence, k=2, n=5 (2^5=32) : 0b_0000_0111_1100_0100_1010_1100_1101_1101u
393
+ return Log2DeBruijn [ ( int ) ( ( value * 0x07C4ACDDu ) >> 27 ) ] ;
398
394
}
399
395
400
396
/// <summary>Returns the integer (ceiling) log of the specified value, base 2.</summary>
You can’t perform that action at this time.
0 commit comments