Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
entities.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "
barretenberg/vm2/generated/columns.hpp
"
4
5
namespace
bb::avm2
{
6
7
// This helper lets us access entities by column.
8
// It is critical to achieve performance when calculating lookup inverses.
9
// See https://github.com/AztecProtocol/aztec-packages/pull/11605 for more details.
10
template
<
typename
Entities>
auto
&
get_entity_by_column
(Entities& entities,
ColumnAndShifts
c)
11
{
12
// A statically constructed pointer to members of the class, indexed by column.
13
// This should only be created once per Entities class.
14
static
std::array<
typename
Entities::DataType(Entities::*),
NUM_COLUMNS_WITH_SHIFTS
> col_ptrs = {
15
AVM2_ALL_ENTITIES_E
(&Entities::)
16
};
17
return
(entities.*col_ptrs[
static_cast<
size_t
>
(c)]);
18
}
19
20
}
// namespace bb::avm2
columns.hpp
AVM2_ALL_ENTITIES_E
#define AVM2_ALL_ENTITIES_E(e)
Definition
columns.hpp:16
bb::avm2
Definition
flavor.hpp:472
bb::avm2::get_entity_by_column
auto & get_entity_by_column(Entities &entities, ColumnAndShifts c)
Definition
entities.hpp:10
bb::avm2::NUM_COLUMNS_WITH_SHIFTS
constexpr auto NUM_COLUMNS_WITH_SHIFTS
Definition
columns.hpp:40
bb::avm2::ColumnAndShifts
ColumnAndShifts
Definition
columns.hpp:35
src
barretenberg
vm2
constraining
entities.hpp
Generated by
1.9.8