Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
lookup_into_bitwise.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cassert>
4
6
7namespace bb::avm2::tracegen {
8
9template <typename LookupSettings> class LookupIntoBitwise : public IndexedLookupTraceBuilder<LookupSettings> {
10 protected:
12 // This is an efficient implementation of indexing into the precomputed table.
13 uint32_t find_in_dst(const TupleType& tup) const override
14 {
15 // row # is derived as:
16 // - input_b: bits 0...7 (0 being LSB)
17 // - input_a: bits 8...15
18 // - op_id: bits 16...
19 // In other words, the first 256*256 rows are for op_id 0. Next are for op_id 1, followed by op_id 2.
20 const auto& [op_id, a, b, _] = tup;
21 return (static_cast<uint32_t>(op_id) << static_cast<uint32_t>(16)) | (static_cast<uint32_t>(a) << 8) |
22 static_cast<uint32_t>(b);
23 }
24};
25
26} // namespace bb::avm2::tracegen
RefTuple< LookupSettings::LOOKUP_TUPLE_SIZE > TupleType
typename IndexedLookupTraceBuilder< LookupSettings >::TupleType TupleType
uint32_t find_in_dst(const TupleType &tup) const override
FF a
FF b