| 104 | } |
| 105 | |
| 106 | const 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 | |
| 123 | bool Varint::Get32(StringPiece* input, uint32_t* value) { |
| 124 | const char* p = input->data(); |
nothing calls this directly
no outgoing calls
no test coverage detected