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

Method Decode32Fallback

encoding/varint.cpp:106–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104}
105
106const char* Varint::Decode32Fallback(const char* p, const char* limit, uint32_t* value) {
107 uint32_t result = 0;
108 for (uint32_t shift = 0; shift <= 28 && p < limit; shift += 7) {
109 uint32_t byte = *(reinterpret_cast<const unsigned char*>(p));
110 p++;
111 if (byte & kIncompleteMask) {
112 // More bytes are present
113 result |= ((byte & 127) << shift);
114 } else {
115 result |= (byte << shift);
116 *value = result;
117 return reinterpret_cast<const char*>(p);
118 }
119 }
120 return NULL;
121}
122
123bool Varint::Get32(StringPiece* input, uint32_t* value) {
124 const char* p = input->data();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected