MCPcopy Create free account
hub / github.com/git/git / encode_varint

Function encode_varint

varint.c:20–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18}
19
20uint8_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}

Callers 3

write_one_dirFunction · 0.70
ce_write_entryFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected