From 2f6ae780d276ee5d10563c5205002901d90e2d54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Fri, 5 Jun 2020 23:08:13 +0200 Subject: [PATCH] Use only uint32_t to immediates items --- lib/fizzy/execute.cpp | 4 ++-- lib/fizzy/parser_expr.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/fizzy/execute.cpp b/lib/fizzy/execute.cpp index cf463fa7b..4ad2f431a 100644 --- a/lib/fizzy/execute.cpp +++ b/lib/fizzy/execute.cpp @@ -17,7 +17,7 @@ namespace fizzy namespace { // code_offset + imm_offset + stack_height + arity -constexpr auto BranchImmediateSize = 3 * sizeof(uint32_t) + sizeof(uint8_t); +constexpr auto BranchImmediateSize = 4 * sizeof(uint32_t); void match_imported_functions(const std::vector& module_imported_types, const std::vector& imported_functions) @@ -249,7 +249,7 @@ void branch( const auto code_offset = read(immediates); const auto imm_offset = read(immediates); const auto stack_height = static_cast(read(immediates)); - const auto arity = read(immediates); + const auto arity = read(immediates); pc = code.instructions.data() + code_offset; immediates = code.immediates.data() + imm_offset; diff --git a/lib/fizzy/parser_expr.cpp b/lib/fizzy/parser_expr.cpp index a306b139b..1ffa8af34 100644 --- a/lib/fizzy/parser_expr.cpp +++ b/lib/fizzy/parser_expr.cpp @@ -133,7 +133,7 @@ void push_branch_immediates(const ControlFrame& frame, bytes& immediates) push(immediates, static_cast(frame.code_offset)); push(immediates, static_cast(frame.immediates_offset)); push(immediates, static_cast(frame.parent_stack_height)); - push(immediates, get_branch_arity(frame)); + push(immediates, uint32_t{get_branch_arity(frame)}); } } // namespace