Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_opcode.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "AvmMini_opcode.hpp"

#include <cstdint>
#include <iomanip>
#include <sstream>

namespace avm_trace {

Expand Down Expand Up @@ -150,4 +153,12 @@ bool Bytecode::has_in_tag(OpCode const op_code)
}
}

std::string to_hex(OpCode opcode)
{
std::ostringstream stream;
// pad with 0s to fill exactly 2 hex characters
stream << std::setfill('0') << std::setw(2) << std::hex << (static_cast<uint8_t>(opcode) & 0xFF);
return stream.str();
}

} // namespace avm_trace
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <cstddef>
#include <cstdint>
#include <string>
#include <unordered_map>

namespace avm_trace {
Expand Down Expand Up @@ -102,4 +103,6 @@ class Bytecode {
static const std::unordered_map<OpCode, size_t> OPERANDS_NUM;
};

std::string to_hex(OpCode opcode);

} // namespace avm_trace
Loading