Ejemplo n.º 1
0
        private static bool SlowEqualCaseInsensitive(ReadOnlySequence <byte> x, ReadOnlySequence <byte> y)
        {
            if (x.Length != y.Length)
            {
                return(false);
            }
            while (!x.IsEmpty)
            {
                ReadOnlySpan <byte> a = x.FirstSpan, b = y.FirstSpan;
                var take = Math.Min(a.Length, b.Length);
                if (take == 0)
                {
                    ThrowHelper.Invalid("math is hard");
                }

                if (!EqualCaseInsensitive(a.Slice(0, take), b.Slice(0, take)))
                {
                    return(false);
                }
                x = x.Slice(take);
                y = y.Slice(take);
            }
            return(true);
        }