Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simplify
Browse files Browse the repository at this point in the history
axic committed May 16, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent e3a4012 commit 9da335e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/fizzy/parser_expr.cpp
Original file line number Diff line number Diff line change
@@ -492,8 +492,7 @@ parser_result<Code> parse_expr(const uint8_t* pos, const uint8_t* end, const Mod
// alignment
uint32_t align;
std::tie(align, pos) = leb128u_decode<uint32_t>(pos, end);
// NOTE: align > 4 is the hard limit (64 / 8) >> 1, and checking it to avoid overflows
if ((align > 4) || ((1 << align) > metrics.memory_width))
if ((1 << static_cast<uint64_t>(align)) > metrics.memory_width)
throw validation_error{"alignment can't exceed operand size"};

// offset

0 comments on commit 9da335e

Please sign in to comment.