private static int EncodeStatusCode(int statusCode, Span <byte> buffer) { if (H3StaticTable.TryGetStatusIndex(statusCode, out var index)) { QPackEncoder.EncodeStaticIndexedHeaderField(index, buffer, out var bytesWritten); return(bytesWritten); } else { // https://tools.ietf.org/html/draft-ietf-quic-qpack-21#section-4.5.4 // Index is 63 - :status buffer[0] = 0b01011111; buffer[1] = 0b00110000; ReadOnlySpan <byte> statusBytes = System.Net.Http.HPack.StatusCodes.ToStatusBytes(statusCode); buffer[2] = (byte)statusBytes.Length; statusBytes.CopyTo(buffer.Slice(3)); return(3 + statusBytes.Length); } }