MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / GetVarint32PtrFallback

Function GetVarint32PtrFallback

tensorflow/core/lib/core/coding.cc:147–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147const char* GetVarint32PtrFallback(const char* p, const char* limit,
148 uint32* value) {
149 uint32 result = 0;
150 for (uint32 shift = 0; shift <= 28 && p < limit; shift += 7) {
151 uint32 byte = *(reinterpret_cast<const unsigned char*>(p));
152 p++;
153 if (byte & 128) {
154 // More bytes are present
155 result |= ((byte & 127) << shift);
156 } else {
157 result |= (byte << shift);
158 *value = result;
159 return reinterpret_cast<const char*>(p);
160 }
161 }
162 return nullptr;
163}
164
165bool GetVarint32(StringPiece* input, uint32* value) {
166 const char* p = input->data();

Callers 1

GetVarint32PtrFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected