MCPcopy Create free account
hub / github.com/ElementsProject/elements / GetVarint64Ptr

Function GetVarint64Ptr

src/leveldb/util/coding.cc:116–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116const char* GetVarint64Ptr(const char* p, const char* limit, uint64_t* value) {
117 uint64_t result = 0;
118 for (uint32_t shift = 0; shift <= 63 && p < limit; shift += 7) {
119 uint64_t byte = *(reinterpret_cast<const uint8_t*>(p));
120 p++;
121 if (byte & 128) {
122 // More bytes are present
123 result |= ((byte & 127) << shift);
124 } else {
125 result |= (byte << shift);
126 *value = result;
127 return reinterpret_cast<const char*>(p);
128 }
129 }
130 return nullptr;
131}
132
133bool GetVarint64(Slice* input, uint64_t* value) {
134 const char* p = input->data();

Callers 2

TESTFunction · 0.85
GetVarint64Function · 0.85

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.68