Migrate FormattingHelpers.CountDigits to using Lzcnt.X64
authorFei Peng <fei.peng@intel.com>
Thu, 15 Nov 2018 23:00:26 +0000 (15:00 -0800)
committerFei Peng <fei.peng@intel.com>
Sat, 1 Dec 2018 02:46:21 +0000 (18:46 -0800)
src/System.Private.CoreLib/shared/System/Buffers/Text/FormattingHelpers.CountDigits.cs

index 8982803..35545c4 100644 (file)
@@ -104,9 +104,9 @@ namespace System.Buffers.Text
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static int CountHexDigits(ulong value)
         {
-            if (Lzcnt.IsSupported && IntPtr.Size == 8)
+            if (Lzcnt.X64.IsSupported)
             {
-                int right = 64 - (int)Lzcnt.LeadingZeroCount(value | 1);
+                int right = 64 - (int)Lzcnt.X64.LeadingZeroCount(value | 1);
                 return (right + 3) >> 2;
             }