Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 361e7dc

Browse files
grant-djkotas
authored andcommitted
Missed optimization from #22497
1 parent 7fa6f45 commit 361e7dc

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

‎src/System.Private.CoreLib/shared/System/Number.BigInteger.cs‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -460,14 +460,7 @@ public static uint CountSignificantBits(uint value)
460460

461461
public static uint CountSignificantBits(ulong value)
462462
{
463-
uint upper = (uint)(value >> 32);
464-
465-
if (upper != 0)
466-
{
467-
return 32 + CountSignificantBits(upper);
468-
}
469-
470-
return CountSignificantBits((uint)value);
463+
return 64 - (uint)BitOps.LeadingZeroCount(value);
471464
}
472465

473466
public static uint CountSignificantBits(ref BigInteger value)

0 commit comments

Comments
 (0)