3#include "barretenberg/ecc/curves/bn254/bn254.hpp"
4#include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp"
5#include "barretenberg/ecc/groups/wnaf.hpp"
7namespace barretenberg::scalar_multiplication {
10constexpr size_t get_optimal_bucket_width(
const size_t num_points)
12 if (num_points >= 14617149) {
15 if (num_points >= 1139094) {
19 if (num_points >= 155975) {
22 if (num_points >= 144834)
27 if (num_points >= 25067) {
30 if (num_points >= 13926) {
33 if (num_points >= 7659) {
36 if (num_points >= 2436) {
39 if (num_points >= 376) {
42 if (num_points >= 231) {
45 if (num_points >= 97) {
48 if (num_points >= 35) {
51 if (num_points >= 10) {
54 if (num_points >= 2) {
60constexpr size_t get_num_rounds(
const size_t num_points)
62 const size_t bits_per_bucket = get_optimal_bucket_width(num_points / 2);
63 return WNAF_SIZE(bits_per_bucket + 1);
67 typename Curve::AffineElement* points;
68 typename Curve::AffineElement* point_pairs_1;
69 typename Curve::AffineElement* point_pairs_2;
70 typename Curve::BaseField* scratch_space;
71 uint32_t* bucket_counts;
72 uint32_t* bit_offsets;
73 uint64_t* point_schedule;
76 bool* bucket_empty_status;
80 using Fq =
typename Curve::BaseField;
81 using AffineElement =
typename Curve::AffineElement;
83 static constexpr size_t MAX_NUM_ROUNDS = 256;
88 size_t prefetch_overflow;
89 std::shared_ptr<void> point_schedule_ptr;
90 std::shared_ptr<void> point_pairs_1_ptr;
91 std::shared_ptr<void> point_pairs_2_ptr;
92 std::shared_ptr<void> scratch_space_ptr;
93 uint64_t* point_schedule;
94 typename Curve::AffineElement* point_pairs_1;
95 typename Curve::AffineElement* point_pairs_2;
96 typename Curve::BaseField* scratch_space;
99 uint32_t* bucket_counts;
100 uint32_t* bit_counts;
101 bool* bucket_empty_status;
102 uint64_t* round_counts;
Definition: runtime_states.hpp:66
Definition: runtime_states.hpp:79