Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include <uintx.hpp>
Public Member Functions | |
constexpr | uintx (const uint64_t &data=0) |
constexpr | uintx (const uint256_t &data) |
constexpr | uintx (const base_uint input_lo) |
constexpr | uintx (const base_uint input_lo, const base_uint input_hi) |
constexpr | uintx (const uintx &other)=default |
constexpr | uintx (uintx &&other) noexcept=default |
uintx & | operator= (const uintx &other)=default |
uintx & | operator= (uintx &&other) noexcept=default |
~uintx ()=default | |
constexpr | operator bool () const |
constexpr | operator uint8_t () const |
constexpr | operator uint16_t () const |
constexpr | operator uint32_t () const |
constexpr | operator uint64_t () const |
constexpr | operator base_uint () const |
bool | get_bit (uint64_t bit_index) const |
constexpr uint64_t | get_msb () const |
constexpr uintx | slice (const uint64_t start, const uint64_t end) const |
constexpr uintx | operator- (const uintx &other) const |
constexpr uintx | operator<< (const uint64_t other) const |
constexpr uintx | operator>> (const uint64_t other) const |
constexpr uintx | operator+ (const uintx &other) const |
uintx | operator- () const |
uintx | operator* (const uintx &other) const |
uintx | operator/ (const uintx &other) const |
uintx | operator% (const uintx &other) const |
std::pair< uintx, uintx > | mul_extended (const uintx &other) const |
constexpr uintx | operator& (const uintx &other) const |
uintx | operator^ (const uintx &other) const |
uintx | operator| (const uintx &other) const |
uintx | operator~ () const |
bool | operator== (const uintx &other) const |
bool | operator!= (const uintx &other) const |
bool | operator! () const |
bool | operator> (const uintx &other) const |
bool | operator< (const uintx &other) const |
bool | operator>= (const uintx &other) const |
bool | operator<= (const uintx &other) const |
uintx & | operator+= (const uintx &other) |
uintx & | operator-= (const uintx &other) |
uintx & | operator*= (const uintx &other) |
uintx & | operator/= (const uintx &other) |
uintx & | operator%= (const uintx &other) |
uintx & | operator++ () |
uintx & | operator-- () |
uintx & | operator&= (const uintx &other) |
uintx & | operator^= (const uintx &other) |
uintx & | operator|= (const uintx &other) |
uintx & | operator>>= (const uint64_t other) |
uintx & | operator<<= (const uint64_t other) |
uintx | invmod (const uintx &modulus) const |
uintx | unsafe_invmod (const uintx &modulus) const |
template<base_uint modulus> | |
std::pair< uintx, uintx > | barrett_reduction () const |
std::pair< uintx, uintx > | divmod (const uintx &b) const |
std::pair< uintx, uintx > | divmod_base (const uintx &b) const |
template<base_uint modulus> | |
std::pair< uintx< base_uint >, uintx< base_uint > > | barrett_reduction () const |
Compute fast division via a barrett reduction Evaluates x = qm + r where m = modulus. returns q, r. | |
Static Public Member Functions | |
static constexpr size_t | length () |
Public Attributes | |
base_uint | lo |
base_uint | hi |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
constexprdefault |
|
constexprdefaultnoexcept |
|
default |
template std::pair< uint1024_t, uint1024_t > bb::numeric::uintx< base_uint >::barrett_reduction< TEST_MODULUS > | ( | ) | const |
std::pair< uintx< base_uint >, uintx< base_uint > > bb::numeric::uintx< base_uint >::barrett_reduction | ( | ) | const |
Compute fast division via a barrett reduction Evaluates x = qm + r where m = modulus. returns q, r.
This implementation is less efficient due to making no assumptions about the value of *self. When using this method to perform modular reductions e.g. (*self) mod m, if (*self) < m^2 a lot of the uintx
operations in this method could be replaced with base_uint
operations
base_uint | |
modulus |
Definition at line 272 of file uintx_impl.hpp.
std::pair< uintx< base_uint >, uintx< base_uint > > bb::numeric::uintx< base_uint >::divmod | ( | const uintx< base_uint > & | b | ) | const |
Definition at line 236 of file uintx_impl.hpp.
std::pair< uintx< base_uint >, uintx< base_uint > > bb::numeric::uintx< base_uint >::divmod_base | ( | const uintx< base_uint > & | b | ) | const |
Definition at line 13 of file uintx_impl.hpp.
bool bb::numeric::uintx< base_uint >::get_bit | ( | uint64_t | bit_index | ) | const |
Definition at line 118 of file uintx_impl.hpp.
|
inlineconstexpr |
uintx< base_uint > bb::numeric::uintx< base_uint >::invmod | ( | const uintx< base_uint > & | modulus | ) | const |
Computes the inverse of *this, modulo modulus, via the extended Euclidean algorithm.
Delegates to appropriate unsafe_invmod (if the modulus is close to uintx top margin there is a need to expand)
modulus | The modulus |
Definition at line 104 of file uintx_impl.hpp.
|
inlinestaticconstexpr |
std::pair< uintx< base_uint >, uintx< base_uint > > bb::numeric::uintx< base_uint >::mul_extended | ( | const uintx< base_uint > & | other | ) | const |
Definition at line 143 of file uintx_impl.hpp.
|
inlineexplicitconstexpr |
|
inlineexplicitconstexpr |
|
inlineexplicitconstexpr |
|
inlineexplicitconstexpr |
|
inlineexplicitconstexpr |
|
inlineexplicitconstexpr |
bool bb::numeric::uintx< base_uint >::operator! | ( | ) | const |
Definition at line 207 of file uintx_impl.hpp.
bool bb::numeric::uintx< base_uint >::operator!= | ( | const uintx< base_uint > & | other | ) | const |
Definition at line 202 of file uintx_impl.hpp.
uintx< base_uint > bb::numeric::uintx< base_uint >::operator% | ( | const uintx< base_uint > & | other | ) | const |
Definition at line 176 of file uintx_impl.hpp.
|
inline |
|
inlineconstexpr |
|
inline |
uintx< base_uint > bb::numeric::uintx< base_uint >::operator* | ( | const uintx< base_uint > & | other | ) | const |
Definition at line 131 of file uintx_impl.hpp.
|
inline |
|
inlineconstexpr |
|
inline |
|
inline |
uintx< base_uint > bb::numeric::uintx< base_uint >::operator- | ( | ) | const |
Definition at line 126 of file uintx_impl.hpp.
|
inlineconstexpr |
|
inline |
|
inline |
uintx< base_uint > bb::numeric::uintx< base_uint >::operator/ | ( | const uintx< base_uint > & | other | ) | const |
Definition at line 170 of file uintx_impl.hpp.
|
inline |
bool bb::numeric::uintx< base_uint >::operator< | ( | const uintx< base_uint > & | other | ) | const |
Definition at line 226 of file uintx_impl.hpp.
|
inlineconstexpr |
|
inline |
bool bb::numeric::uintx< base_uint >::operator<= | ( | const uintx< base_uint > & | other | ) | const |
Definition at line 231 of file uintx_impl.hpp.
|
default |
|
defaultnoexcept |
bool bb::numeric::uintx< base_uint >::operator== | ( | const uintx< base_uint > & | other | ) | const |
Definition at line 197 of file uintx_impl.hpp.
bool bb::numeric::uintx< base_uint >::operator> | ( | const uintx< base_uint > & | other | ) | const |
Definition at line 212 of file uintx_impl.hpp.
bool bb::numeric::uintx< base_uint >::operator>= | ( | const uintx< base_uint > & | other | ) | const |
Definition at line 221 of file uintx_impl.hpp.
|
inlineconstexpr |
|
inline |
uintx< base_uint > bb::numeric::uintx< base_uint >::operator^ | ( | const uintx< base_uint > & | other | ) | const |
Definition at line 182 of file uintx_impl.hpp.
|
inline |
uintx< base_uint > bb::numeric::uintx< base_uint >::operator| | ( | const uintx< base_uint > & | other | ) | const |
Definition at line 187 of file uintx_impl.hpp.
|
inline |
uintx< base_uint > bb::numeric::uintx< base_uint >::operator~ | ( | ) | const |
Definition at line 192 of file uintx_impl.hpp.
|
inlineconstexpr |
uintx< base_uint > bb::numeric::uintx< base_uint >::unsafe_invmod | ( | const uintx< base_uint > & | modulus | ) | const |
Computes invmod. Only for internal usage within the class. This is an insecure version of the algorithm that doesn't take into account the 0 case and cases when modulus is close to the top margin.
modulus | The modulus of the ring |
Definition at line 72 of file uintx_impl.hpp.
base_uint bb::numeric::uintx< base_uint >::hi |
base_uint bb::numeric::uintx< base_uint >::lo |