MCPcopy Create free account
hub / github.com/apache/kvrocks / EncodeVarint32

Function EncodeVarint32

src/common/encoding.cc:74–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74char *EncodeVarint32(char *dst, uint32_t v) {
75 // Operate on characters as unsigneds
76 auto *ptr = reinterpret_cast<unsigned char *>(dst);
77 do {
78 *ptr = 0x80 | v;
79 v >>= 7, ++ptr;
80 } while (v != 0);
81 *(ptr - 1) &= 0x7F;
82 return reinterpret_cast<char *>(ptr);
83}
84
85void PutVarint32(std::string *dst, uint32_t v) {
86 char buf[5];

Callers 1

PutVarint32Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected