| 18 | } |
| 19 | |
| 20 | uint8_t encode_varint(uint64_t value, unsigned char *buf) |
| 21 | { |
| 22 | unsigned char varint[16]; |
| 23 | unsigned pos = sizeof(varint) - 1; |
| 24 | varint[pos] = value & 127; |
| 25 | while (value >>= 7) |
| 26 | varint[--pos] = 128 | (--value & 127); |
| 27 | if (buf) |
| 28 | memcpy(buf, varint + pos, sizeof(varint) - pos); |
| 29 | return sizeof(varint) - pos; |
| 30 | } |
no outgoing calls
no test coverage detected