From ea71ca77ae65b1391baa8de77fd357f5fc616e3c Mon Sep 17 00:00:00 2001 From: Grant Date: Thu, 14 Feb 2019 18:21:52 -0800 Subject: [PATCH] Missed optimization from dotnet/coreclr#22497 Commit migrated from https://github.com/dotnet/coreclr/commit/361e7dc5ee73b8d86fd9ec16b0fdec6ac7302b16 --- .../System.Private.CoreLib/src/System/Number.BigInteger.cs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Number.BigInteger.cs b/src/libraries/System.Private.CoreLib/src/System/Number.BigInteger.cs index 607b450..07c4112 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Number.BigInteger.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Number.BigInteger.cs @@ -460,14 +460,7 @@ namespace System public static uint CountSignificantBits(ulong value) { - uint upper = (uint)(value >> 32); - - if (upper != 0) - { - return 32 + CountSignificantBits(upper); - } - - return CountSignificantBits((uint)value); + return 64 - (uint)BitOps.LeadingZeroCount(value); } public static uint CountSignificantBits(ref BigInteger value) -- 2.7.4