MCPcopy Create free account
hub / github.com/chen3feng/toft / Decode64

Method Decode64

encoding/varint.cpp:135–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135const char* Varint::Decode64(const char* p, const char* limit, uint64_t* value) {
136 uint64_t result = 0;
137 for (uint32_t shift = 0; shift <= 63 && p < limit; shift += 7) {
138 uint64_t byte = *(reinterpret_cast<const unsigned char*>(p));
139 p++;
140 if (byte & kIncompleteMask) {
141 // More bytes are present
142 result |= ((byte & 127) << shift);
143 } else {
144 result |= (byte << shift);
145 *value = result;
146 return reinterpret_cast<const char*>(p);
147 }
148 }
149 return NULL;
150}
151
152bool Varint::Get64(StringPiece* input, uint64_t* value) {
153 const char* p = input->data();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected