Exemplo n.º 1
0
        public static int Seek(Position begin, Position end, out Position result, byte byte0, byte byte1, byte byte2)
        {
            var enumerator = new ReadOnlyBuffer(begin, end).GetEnumerator();

            while (enumerator.MoveNext())
            {
                var span  = enumerator.Current.Span;
                int index = span.IndexOfAny(byte0, byte1, byte2);

                if (index != -1)
                {
                    result = enumerator.CreateCursor(index);
                    return(span[index]);
                }
            }

            result = end;
            return(-1);
        }