Skip to content

Commit

Permalink
Fix signed left-shift
Browse files Browse the repository at this point in the history
  • Loading branch information
tbfleming committed Sep 11, 2018
1 parent 5fa8b29 commit 1b38fd6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/abieos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,9 @@ struct varint32 {
int32_t value = 0;
};

inline void push_varint32(std::vector<char>& bin, int32_t v) { push_varuint32(bin, uint32_t((v << 1) ^ (v >> 31))); }
inline void push_varint32(std::vector<char>& bin, int32_t v) {
push_varuint32(bin, (uint32_t(v) << 1) ^ uint32_t(v >> 31));
}

inline int32_t read_varint32(input_buffer& bin) {
uint32_t v = read_varuint32(bin);
Expand Down

0 comments on commit 1b38fd6

Please sign in to comment.