Skip to content

Commit

Permalink
treat enum,bool as 32bit; shrink ReadVarint32
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisse74 authored and acozzette committed Dec 6, 2019
1 parent 91ed6dc commit b4596f8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/google/protobuf/map_type_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions src/google/protobuf/parse_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b4596f8

Please sign in to comment.