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 <cstdint>
4
6
7namespace bb::avm2::tracegen {
8
9template <typename LookupSettings> class LookupIntoBitwise : public IndexedLookupTraceBuilder<LookupSettings> {
10 public:
11 // Inherit the base constructors (incl. the outer_dst_selector one) so the interaction can be registered
12 // with an explicit outer selector (precomputed.sel_range_16); the base process() then toggles the
13 // fine-grained DST_SELECTOR (precomputed.sel_bitwise) only on the rows actually read.
15
16 protected:
18 // This is an efficient implementation of indexing into the precomputed table.
19 uint32_t find_in_dst(const TupleType& tup) const override
20 {
21 // row # is derived as:
22 // - input_b: bits 0...7 (0 being LSB)
23 // - input_a: bits 8...15
24 const auto& [a, b, c_and, c_or, c_xor] = tup;
25 return (static_cast<uint32_t>(a) << 8) | static_cast<uint32_t>(b);
26 }
27};
28
29} // 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