treat enum,bool as 32bit; shrink ReadVarint32

pull/6999/head
Christian Maurer 5 years ago committed by Adam Cozzette
parent 91ed6dcb5b
commit b4596f8e99
  1. 4
      src/google/protobuf/map_type_handler.h
  2. 4
      src/google/protobuf/parse_context.h

@ -467,11 +467,11 @@ inline const char* ReadSINT32(const char* ptr, int32* value) {
}
template <typename E>
inline const char* ReadENUM(const char* ptr, E* value) {
*value = static_cast<E>(ReadVarint64(&ptr));
*value = static_cast<E>(ReadVarint32(&ptr));
return ptr;
}
inline const char* ReadBOOL(const char* ptr, bool* value) {
*value = static_cast<bool>(ReadVarint64(&ptr));
*value = static_cast<bool>(ReadVarint32(&ptr));
return ptr;
}

@ -586,9 +586,9 @@ inline uint64 ReadVarint64(const char** p) {
}
inline uint32 ReadVarint32(const char** p) {
uint64 tmp;
uint32 tmp;
*p = VarintParse(*p, &tmp);
return static_cast<uint32>(tmp);
return tmp;
}
inline int64 ReadVarintZigZag64(const char** p) {

Loading…
Cancel
Save