private static unsafe bool TryParseHex()

in Microsoft.Shared.Dna.Json/JsonParser.cs [656:682]


        private static unsafe bool TryParseHex(char* payloadPointer, int first, int last, out ushort value)
        {
            value = default(ushort);
            ushort accumulator = 0;
            byte digit = default(byte);
            for (int i = first; i < last; i++)
            {
                if (JsonParser.TryConvertHex(*(payloadPointer + i), out digit))
                {
                    try
                    {
                        accumulator = checked((ushort)((accumulator * JsonConstants.HexRadix) + digit));
                    }
                    catch (OverflowException)
                    {
                        return false;
                    }
                }
                else
                {
                    return false;
                }
            }

            value = accumulator;
            return true;
        }