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
5
#include "
barretenberg/vm2/tracegen/lib/lookup_builder.hpp
"
6
7
namespace
bb::avm2::tracegen
{
8
9
template
<
typename
LookupSettings>
class
LookupIntoBitwise
:
public
IndexedLookupTraceBuilder
<LookupSettings> {
10
protected
:
11
using
TupleType
=
typename
IndexedLookupTraceBuilder<LookupSettings>::TupleType
;
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
bb::avm2::tracegen::IndexedLookupTraceBuilder
Definition
lookup_builder.hpp:24
bb::avm2::tracegen::IndexedLookupTraceBuilder::TupleType
RefTuple< LookupSettings::LOOKUP_TUPLE_SIZE > TupleType
Definition
lookup_builder.hpp:64
bb::avm2::tracegen::LookupIntoBitwise
Definition
lookup_into_bitwise.hpp:9
bb::avm2::tracegen::LookupIntoBitwise::TupleType
typename IndexedLookupTraceBuilder< LookupSettings >::TupleType TupleType
Definition
lookup_into_bitwise.hpp:11
bb::avm2::tracegen::LookupIntoBitwise::find_in_dst
uint32_t find_in_dst(const TupleType &tup) const override
Definition
lookup_into_bitwise.hpp:13
a
FF a
Definition
field_gt.test.cpp:52
b
FF b
Definition
field_gt.test.cpp:53
lookup_builder.hpp
bb::avm2::tracegen
Definition
full_row.hpp:9
src
barretenberg
vm2
tracegen
lib
lookup_into_bitwise.hpp
Generated by
1.9.8