Ejemplo n.º 1
0
        public static int SeekEndOfChunkedStream(byte[] buffer, int start, int end)
        {
            while (start + 4 < end)
            {
                if (!ByteHelpers.ContainsPossibly(buffer, start, end, ref _zeroReturnVector))
                {
                    start += Vector <byte> .Count;
                    continue;
                }

                var c = 0;

                while (start + 4 < end && c < Vector <byte> .Count)
                {
                    if (buffer[start + 0] == 48 &&
                        buffer[start + 1] == 13 &&
                        buffer[start + 2] == 10 &&
                        buffer[start + 3] == 13 &&
                        buffer[start + 4] == 10)
                    {
                        return(start + 5);
                    }

                    c++;
                    start++;
                }
            }

            return(-1);
        }