Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
helpers.cpp File Reference

Go to the source code of this file.

Functions

uint32_t pow_num (uint32_t base, uint32_t exp)
 
smt_circuit::STerm pow2_8 (smt_circuit::STerm v0, smt_solver::Solver *solver)
 Calculates power of 2.
 
smt_circuit::STerm shl (smt_circuit::STerm v0, smt_circuit::STerm v1, smt_solver::Solver *solver)
 Left shift operation without truncation.
 
smt_circuit::STerm shr (smt_circuit::STerm v0, smt_circuit::STerm v1, smt_solver::Solver *solver)
 Right shift operation.
 
smt_circuit::STerm shl64 (smt_circuit::STerm v0, smt_circuit::STerm v1, smt_solver::Solver *solver)
 Left shift operation with 64-bit truncation.
 
smt_circuit::STerm shl32 (smt_circuit::STerm v0, smt_circuit::STerm v1, smt_solver::Solver *solver)
 Left shift operation with 32-bit truncation.
 
smt_circuit::STerm idiv (smt_circuit::STerm v0, smt_circuit::STerm v1, uint32_t bit_size, smt_solver::Solver *solver)
 Signed division in noir-style.
 

Function Documentation

◆ idiv()

smt_circuit::STerm idiv ( smt_circuit::STerm  v0,
smt_circuit::STerm  v1,
uint32_t  bit_size,
smt_solver::Solver solver 
)

Signed division in noir-style.

Parameters
v0Numerator
v1Denominator
bit_sizebit sizes of numerator and denominator
solverSMT solver instance
Returns
Result of (v0 / v1)

Definition at line 61 of file helpers.cpp.

◆ pow2_8()

Calculates power of 2.

Parameters
v0Exponent (8-bit value)
solverSMT solver instance
Returns
2^v0

Definition at line 16 of file helpers.cpp.

◆ pow_num()

uint32_t pow_num ( uint32_t  base,
uint32_t  exp 
)

Definition at line 6 of file helpers.cpp.

◆ shl()

Left shift operation without truncation.

Parameters
v0Value to shift
v1Number of bits to shift (8-bit value)
solverSMT solver instance
Returns
Result of (v0 << v1) without truncation

Definition at line 34 of file helpers.cpp.

◆ shl32()

Left shift operation with 32-bit truncation.

Parameters
v0Value to shift
v1Number of bits to shift (8-bit value)
solverSMT solver instance
Returns
Result of (v0 << v1) truncated to 32 bits

Definition at line 54 of file helpers.cpp.

◆ shl64()

Left shift operation with 64-bit truncation.

Parameters
v0Value to shift
v1Number of bits to shift (8-bit value)
solverSMT solver instance
Returns
Result of (v0 << v1) truncated to 64 bits

Definition at line 47 of file helpers.cpp.

◆ shr()

Right shift operation.

Parameters
v0Value to shift
v1Number of bits to shift (8-bit value)
solverSMT solver instance
Returns
Result of (v0 >> v1)

Definition at line 40 of file helpers.cpp.