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

Function GetVarint32PtrFallback

src/common/encoding.cc:91–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91const char *GetVarint32PtrFallback(const char *p, const char *limit, uint32_t *value) {
92 uint32_t result = 0;
93 for (uint32_t shift = 0; shift <= 28 && p < limit; shift += 7) {
94 uint32_t byte = static_cast<unsigned char>(*p);
95 p++;
96 if (byte & 0x80) {
97 // More bytes are present
98 result |= ((byte & 0x7F) << shift);
99 } else {
100 result |= (byte << shift);
101 *value = result;
102 return p;
103 }
104 }
105 return nullptr;
106}
107
108const char *GetVarint32Ptr(const char *p, const char *limit, uint32_t *value) {
109 if (p < limit) {

Callers 1

GetVarint32PtrFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected