Exemple #1
0
        public void WriteTo(Span <byte> buffer)
        {
            Debug.Assert(buffer.Length >= Size);
            byte command = _shortLiteralLength > 0 ?
                           _shortLiteralLength :
                           (byte)(_baseCommand + (byte)_lengthArg.Modifier);

            buffer[0] = command;
            _lengthArg.WriteTo(buffer.Slice(1));
        }
Exemple #2
0
        public void WriteTo(Span <byte> buffer)
        {
            Debug.Assert(buffer.Length >= Size);
            byte command = (byte)(_baseCommand +
                                  (4 * (byte)_start.Modifier) +
                                  (byte)_length.Modifier);

            buffer[0] = command;
            _start.WriteTo(buffer.Slice(1));
            _length.WriteTo(buffer.Slice(1 + _start.Size));
        }