Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::stdlib::logic< Builder > Class Template Reference

#include <logic.hpp>

Public Types

using field_pt = field_t< Builder >
 
using witness_pt = witness_t< Builder >
 

Static Public Member Functions

static field_pt create_logic_constraint (field_pt &a, field_pt &b, size_t num_bits, bool is_xor_gate, const std::function< std::pair< uint256_t, uint256_t >(uint256_t, uint256_t, size_t)> &get_chunk=[](uint256_t left, uint256_t right, size_t chunk_size) { uint256_t left_chunk=left &((uint256_t(1)<< chunk_size) - 1);uint256_t right_chunk=right &((uint256_t(1)<< chunk_size) - 1);return std::make_pair(left_chunk, right_chunk);})
 A logical AND or XOR over a variable number of bits.
 

Detailed Description

template<typename Builder>
class bb::stdlib::logic< Builder >

Definition at line 18 of file logic.hpp.

Member Typedef Documentation

◆ field_pt

template<typename Builder >
using bb::stdlib::logic< Builder >::field_pt = field_t<Builder>

Definition at line 20 of file logic.hpp.

◆ witness_pt

Definition at line 21 of file logic.hpp.

Member Function Documentation

◆ create_logic_constraint()

template<typename Builder >
field_t< Builder > bb::stdlib::logic< Builder >::create_logic_constraint ( field_pt a,
field_pt b,
size_t  num_bits,
bool  is_xor_gate,
const std::function< std::pair< uint256_t, uint256_t >(uint256_t, uint256_t, size_t)> &  get_chunk = [](uint256_t left, uint256_t right, size_t chunk_size) { uint256_t left_chunk = left & ((uint256_t(1) << chunk_size) - 1); uint256_t right_chunk = right & ((uint256_t(1) << chunk_size) - 1); return std::make_pair(left_chunk, right_chunk); } 
)
static

A logical AND or XOR over a variable number of bits.

If the left and right operands are larger than num_bits, the result will be truncated to num_bits. However, the two operands could be range-constrained to num_bits before the call, which would remove the need to range constrain inside this function.

Template Parameters
Builder
Parameters
a
b
num_bits
is_xor_gate
Returns
field_t<Builder>

Definition at line 32 of file logic.cpp.


The documentation for this class was generated from the following files: