Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
lookup_into_p_decomposition.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4#include <cstddef>
5#include <cstdint>
6
9
10namespace bb::avm2::tracegen {
11
12template <typename LookupSettings> class LookupIntoPDecomposition : public IndexedLookupTraceBuilder<LookupSettings> {
13 protected:
15 uint32_t find_in_dst(const TupleType& tup) const override
16 {
17 static const std::array<uint32_t, 257> cumulative_p_limb_index = []() {
19 sums[0] = 0;
20 for (size_t i = 1; i < 257; ++i) {
21 sums[i] = sums[i - 1] + static_cast<uint32_t>(get_p_limbs_per_radix_size(i - 1));
22 }
23 return sums;
24 }();
25
26 const auto& [radix, limb_index, _] = tup;
27 return cumulative_p_limb_index.at(static_cast<size_t>(static_cast<uint64_t>(radix))) +
28 static_cast<uint32_t>(limb_index);
29 }
30};
31
32} // 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
size_t get_p_limbs_per_radix_size(size_t radix)
Gets the number of limbs that the modulus, p, decomposes into for a given radix.
Definition to_radix.cpp:75
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13