Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
instruction_builder.cpp
Go to the documentation of this file.
2
3namespace bb::avm2::testing {
4
6{
7 // First we compute the indirect and relative contributions of each operand.
8 uint16_t indirect = 0;
9 for (size_t i = 0; i < operands.size(); ++i) {
10 if (operands[i].is_relative) {
11 indirect |= static_cast<uint16_t>(1 << (i * 2 + 1));
12 }
13 if (operands[i].is_indirect) {
14 indirect |= static_cast<uint16_t>(1 << (i * 2));
15 }
16 }
17
18 // Then we build the instruction.
20 operands_vec.reserve(operands.size());
21 for (const auto& operand : operands) {
22 operands_vec.push_back(operand.operand);
23 }
24 return simulation::Instruction(opcode, indirect, std::move(operands_vec));
25}
26
27} // namespace bb::avm2::testing
simulation::Instruction build() const
InstructionBuilder & operand(OperandBuilder operand)
std::vector< OperandBuilder > operands
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13