| 36 | } |
| 37 | |
| 38 | void ProtoBuffer::putVarInt(u64 n) { |
| 39 | ensureCapacity(varIntSize(n)); |
| 40 | while ((n >> 7) != 0) { |
| 41 | _data[_offset++] = (unsigned char) (0x80 | n); |
| 42 | n >>= 7; |
| 43 | } |
| 44 | _data[_offset++] = (unsigned char) n; |
| 45 | } |
| 46 | |
| 47 | void ProtoBuffer::tag(protobuf_index_t index, protobuf_t type) { |
| 48 | putVarInt((u64) (index << 3 | type)); |