34 #ifndef GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_VARINT_H
35 #define GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_VARINT_H
52 #define GRPC_CHTTP2_MAX_IN_PREFIX(prefix_bits) ((1 << (8 - (prefix_bits))) - 1)
55 #define GRPC_CHTTP2_VARINT_LENGTH(n, prefix_bits) \
56 ((n) < GRPC_CHTTP2_MAX_IN_PREFIX(prefix_bits) \
58 : grpc_chttp2_hpack_varint_length( \
59 (n)-GRPC_CHTTP2_MAX_IN_PREFIX(prefix_bits)))
61 #define GRPC_CHTTP2_WRITE_VARINT(n, prefix_bits, prefix_or, target, length) \
63 gpr_uint8* tgt = target; \
64 if ((length) == 1) { \
65 (tgt)[0] = (prefix_or) | (n); \
67 (tgt)[0] = (prefix_or) | GRPC_CHTTP2_MAX_IN_PREFIX(prefix_bits); \
68 grpc_chttp2_hpack_write_varint_tail( \
69 (n)-GRPC_CHTTP2_MAX_IN_PREFIX(prefix_bits), (tgt) + 1, (length)-1); \
int grpc_chttp2_hpack_varint_length(gpr_uint32 tail_value)
Definition: varint.c:36
void grpc_chttp2_hpack_write_varint_tail(gpr_uint32 tail_value, gpr_uint8 *target, int tail_length)
Definition: varint.c:50