Example #1
0
            private double ReadFloat()
            {
                MutableString value = ReadString();

                if (value.Equals(_positiveInfinityString))
                {
                    return(Double.PositiveInfinity);
                }
                if (value.Equals(_negativeInfinityString))
                {
                    return(Double.NegativeInfinity);
                }
                if (value.Equals(_nanString))
                {
                    return(Double.NaN);
                }

                // TODO: MRI appears to have an optimization that saves the (binary) mantissa at the end of the string
                int pos = value.IndexOf((byte)0);

                if (pos >= 0)
                {
                    value.Remove(pos, value.Length - pos);
                }
                return(Protocols.ConvertStringToFloat(Context, value));
            }
Example #2
0
        private static int SkipToUnescapedForwardSlash(MutableString /*!*/ pattern, int patternLength, int i)
        {
            while (i < patternLength)
            {
                i = pattern.IndexOf('/', i);
                if (i <= 0)
                {
                    return(i);
                }

                if (pattern.GetChar(i - 1) != '\\')
                {
                    return(i);
                }

                i++;
            }
            return(-1);
        }