Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::ecc::booth Namespace Reference

Classes

struct  BoothSliceParams
 Per-window precomputed slice parameters for the carry-less signed-Booth window recoding. Read out by the per-(point, window) hot loop as two i32 loads + a fixed bit-twiddle (no branches, no per-iter address arithmetic). More...
 

Functions

constexpr BoothSliceParams compute_booth_slice_params_unchecked (size_t bit_offset, size_t window_bits, size_t num_uint64_limbs) noexcept
 Compute the Booth slice params for a window starting at absolute bit position bit_offset. The slice is [bit_offset - 1, bit_offset + window_bits); the bit at bit_offset - 1 is the shared boundary bit. The bottom window (bit_offset == 0) is encoded specially so the same recoding algebra applies — read "limb -1" as a zero-masked load.
 
BoothSliceParams compute_booth_slice_params (size_t bit_offset, size_t window_bits, size_t num_uint64_limbs) noexcept
 
template<size_t NUM_WINDOWS, size_t WINDOW_BITS, size_t NUM_UINT64_LIMBS>
constexpr std::array< BoothSliceParams, NUM_WINDOWS > make_booth_slice_params () noexcept
 
template<size_t NUM_WINDOWS, size_t WINDOW_BITS, size_t LOW_WINDOW_BITS, size_t NUM_UINT64_LIMBS>
constexpr std::array< BoothSliceParams, NUM_WINDOWS > make_offset_booth_slice_params () noexcept
 
uint32_t booth_packed_digit (const uint64_t *s, const BoothSliceParams &sp, size_t window_bits) noexcept
 Read a (window_bits+1)-bit window from s[] (uint64 limbs) and apply Constantine's signedWindowEncoding to produce a (sign | magnitude) packed digit: bit 31 = sign (1 = negative), bits 0..30 = magnitude in [0, 2^(window_bits-1)]. Magnitude 0 means the window contributes nothing.
 

Function Documentation

◆ booth_packed_digit()

uint32_t bb::ecc::booth::booth_packed_digit ( const uint64_t *  s,
const BoothSliceParams sp,
size_t  window_bits 
)
inlinenoexcept

Read a (window_bits+1)-bit window from s[] (uint64 limbs) and apply Constantine's signedWindowEncoding to produce a (sign | magnitude) packed digit: bit 31 = sign (1 = negative), bits 0..30 = magnitude in [0, 2^(window_bits-1)]. Magnitude 0 means the window contributes nothing.

Two unconditional limb loads; windows entirely inside one uint64 still work because hi_mask == 0, so hi_part vanishes without a branch.

Definition at line 146 of file booth_recode.hpp.

◆ compute_booth_slice_params()

BoothSliceParams bb::ecc::booth::compute_booth_slice_params ( size_t  bit_offset,
size_t  window_bits,
size_t  num_uint64_limbs 
)
inlinenoexcept

Definition at line 98 of file booth_recode.hpp.

◆ compute_booth_slice_params_unchecked()

constexpr BoothSliceParams bb::ecc::booth::compute_booth_slice_params_unchecked ( size_t  bit_offset,
size_t  window_bits,
size_t  num_uint64_limbs 
)
constexprnoexcept

Compute the Booth slice params for a window starting at absolute bit position bit_offset. The slice is [bit_offset - 1, bit_offset + window_bits); the bit at bit_offset - 1 is the shared boundary bit. The bottom window (bit_offset == 0) is encoded specially so the same recoding algebra applies — read "limb -1" as a zero-masked load.

constexpr so callers with compile-time window schedules (element_impl's GLV-endo 32-window table) can materialise the param array at compile time, while runtime-schedule callers (Pippenger) use the checked wrapper at runtime.

Definition at line 49 of file booth_recode.hpp.

◆ make_booth_slice_params()

template<size_t NUM_WINDOWS, size_t WINDOW_BITS, size_t NUM_UINT64_LIMBS>
constexpr std::array< BoothSliceParams, NUM_WINDOWS > bb::ecc::booth::make_booth_slice_params ( )
constexprnoexcept

Definition at line 108 of file booth_recode.hpp.

◆ make_offset_booth_slice_params()

template<size_t NUM_WINDOWS, size_t WINDOW_BITS, size_t LOW_WINDOW_BITS, size_t NUM_UINT64_LIMBS>
constexpr std::array< BoothSliceParams, NUM_WINDOWS > bb::ecc::booth::make_offset_booth_slice_params ( )
constexprnoexcept

Definition at line 121 of file booth_recode.hpp.