|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include <uint256.hpp>
Public Member Functions | |
| constexpr | uint256_t () noexcept |
| template<std::integral T> requires (!std::same_as<std::remove_cv_t<T>, bool> && sizeof(T) <= sizeof(uint64_t)) | |
| constexpr | uint256_t (T value) noexcept |
| constexpr | uint256_t (const uint64_t a, const uint64_t b, const uint64_t c, const uint64_t d) noexcept |
| constexpr | uint256_t (const uint128_t &a) noexcept |
| constexpr | uint256_t (const uint256_t &other) noexcept |
| constexpr | uint256_t (uint256_t &&other) noexcept=default |
| constexpr | uint256_t (const std::string &input) noexcept |
| constexpr uint256_t & | operator= (const uint256_t &other) noexcept=default |
| constexpr uint256_t & | operator= (uint256_t &&other) noexcept=default |
| constexpr | ~uint256_t () noexcept=default |
| constexpr | operator bool () const |
| constexpr | operator uint128_t () const |
| template<std::integral T> | |
| constexpr | operator T () const |
| constexpr bool | get_bit (uint64_t bit_index) const |
| constexpr uint64_t | get_msb () const |
| constexpr uint256_t | slice (uint64_t start, uint64_t end) const |
| constexpr uint256_t | pow (const uint256_t &exponent) const |
| constexpr uint256_t | operator+ (const uint256_t &other) const |
| constexpr uint256_t | operator- (const uint256_t &other) const |
| constexpr uint256_t | operator- () const |
| constexpr uint256_t | operator* (const uint256_t &other) const |
| constexpr uint256_t | operator/ (const uint256_t &other) const |
| constexpr uint256_t | operator% (const uint256_t &other) const |
| constexpr uint256_t | operator>> (const uint256_t &other) const |
| constexpr uint256_t | operator<< (const uint256_t &other) const |
| constexpr uint256_t | operator& (const uint256_t &other) const |
| constexpr uint256_t | operator^ (const uint256_t &other) const |
| constexpr uint256_t | operator| (const uint256_t &other) const |
| constexpr uint256_t | operator~ () const |
| constexpr bool | operator== (const uint256_t &other) const |
| constexpr bool | operator!= (const uint256_t &other) const |
| constexpr bool | operator! () const |
| constexpr bool | operator> (const uint256_t &other) const |
| constexpr bool | operator< (const uint256_t &other) const |
| constexpr bool | operator>= (const uint256_t &other) const |
| constexpr bool | operator<= (const uint256_t &other) const |
| constexpr uint256_t & | operator+= (const uint256_t &other) |
| constexpr uint256_t & | operator-= (const uint256_t &other) |
| constexpr uint256_t & | operator*= (const uint256_t &other) |
| constexpr uint256_t & | operator/= (const uint256_t &other) |
| constexpr uint256_t & | operator%= (const uint256_t &other) |
| constexpr uint256_t & | operator++ () |
| constexpr uint256_t & | operator-- () |
| constexpr uint256_t & | operator&= (const uint256_t &other) |
| constexpr uint256_t & | operator^= (const uint256_t &other) |
| constexpr uint256_t & | operator|= (const uint256_t &other) |
| constexpr uint256_t & | operator>>= (const uint256_t &other) |
| constexpr uint256_t & | operator<<= (const uint256_t &other) |
| constexpr std::pair< uint256_t, uint256_t > | mul_extended (const uint256_t &other) const |
| Compute the result of multiplication modulu 2**512. | |
| constexpr std::pair< uint256_t, uint256_t > | divmod (const uint256_t &b) const |
| constexpr std::pair< uint256_t, uint64_t > | divmod (uint64_t b) const |
| Optimized divmod for a single-limb divisor using schoolbook long division in base 2^64. For smaller divisors this is significantly faster than the general divmod. Each iteration divides a 128-bit intermediate (remainder << 64 | limb) by b, which is safe because the invariant remainder < b guarantees the quotient limb fits in 64 bits. Falls back to the uint256_t overload for wasm. | |
| size_t | hash () const noexcept |
| void | msgpack_pack (auto &packer) const |
| void | msgpack_unpack (auto o) |
| void | msgpack_schema (auto &packer) const |
Static Public Member Functions | |
| static constexpr size_t | length () |
Public Attributes | |
| uint64_t | data [4] |
Static Private Member Functions | |
| static constexpr std::pair< uint64_t, uint64_t > | mul_wide (uint64_t a, uint64_t b) |
| static constexpr std::pair< uint64_t, uint64_t > | addc (uint64_t a, uint64_t b, uint64_t carry_in) |
| static constexpr uint64_t | addc_discard_hi (uint64_t a, uint64_t b, uint64_t carry_in) |
| static constexpr uint64_t | sbb_discard_hi (uint64_t a, uint64_t b, uint64_t borrow_in) |
| static constexpr std::pair< uint64_t, uint64_t > | sbb (uint64_t a, uint64_t b, uint64_t borrow_in) |
| static constexpr uint64_t | mac_discard_hi (uint64_t a, uint64_t b, uint64_t c, uint64_t carry_in) |
| static constexpr std::pair< uint64_t, uint64_t > | mac (uint64_t a, uint64_t b, uint64_t c, uint64_t carry_in) |
| static constexpr void | wasm_madd (const uint64_t &left_limb, const uint64_t *right_limbs, uint64_t &result_0, uint64_t &result_1, uint64_t &result_2, uint64_t &result_3, uint64_t &result_4, uint64_t &result_5, uint64_t &result_6, uint64_t &result_7, uint64_t &result_8) |
| Multiply one limb by 9 limbs and add to resulting limbs. | |
| static constexpr std::array< uint64_t, WASM_NUM_LIMBS > | wasm_convert (const uint64_t *data) |
| Convert from 4 64-bit limbs to 9 29-bit limbs. | |
Definition at line 32 of file uint256.hpp.
|
inlineconstexprnoexcept |
Definition at line 39 of file uint256.hpp.
|
inlineconstexprnoexcept |
Definition at line 49 of file uint256.hpp.
|
inlineconstexprnoexcept |
Definition at line 53 of file uint256.hpp.
|
inlineconstexprnoexcept |
Definition at line 57 of file uint256.hpp.
|
inlineconstexprnoexcept |
Definition at line 61 of file uint256.hpp.
|
constexprdefaultnoexcept |
|
inlineexplicitconstexprnoexcept |
Definition at line 66 of file uint256.hpp.
|
constexprdefaultnoexcept |
|
staticconstexprprivate |
Definition at line 32 of file uint256_impl.hpp.
|
staticconstexprprivate |
Definition at line 41 of file uint256_impl.hpp.
|
constexpr |
Definition at line 135 of file uint256_impl.hpp.
|
constexpr |
Optimized divmod for a single-limb divisor using schoolbook long division in base 2^64. For smaller divisors this is significantly faster than the general divmod. Each iteration divides a 128-bit intermediate (remainder << 64 | limb) by b, which is safe because the invariant remainder < b guarantees the quotient limb fits in 64 bits. Falls back to the uint256_t overload for wasm.
Definition at line 190 of file uint256_impl.hpp.
|
constexpr |
Definition at line 358 of file uint256_impl.hpp.
|
constexpr |
Definition at line 368 of file uint256_impl.hpp.
|
inlinenoexcept |
Definition at line 224 of file uint256.hpp.
|
inlinestaticconstexpr |
Definition at line 151 of file uint256.hpp.
|
staticconstexprprivate |
Definition at line 62 of file uint256_impl.hpp.
|
staticconstexprprivate |
Definition at line 76 of file uint256_impl.hpp.
| void bb::numeric::uint256_t::msgpack_pack | ( | auto & | packer | ) | const |
Definition at line 668 of file uint256_impl.hpp.
|
inline |
Definition at line 229 of file uint256.hpp.
| void bb::numeric::uint256_t::msgpack_unpack | ( | auto | o | ) |
Definition at line 681 of file uint256_impl.hpp.
|
constexpr |
Compute the result of multiplication modulu 2**512.
Definition at line 219 of file uint256_impl.hpp.
|
staticconstexprprivate |
Definition at line 14 of file uint256_impl.hpp.
|
inlineexplicitconstexpr |
Definition at line 112 of file uint256.hpp.
|
inlineexplicitconstexpr |
Definition at line 118 of file uint256.hpp.
|
inlineexplicitconstexpr |
Definition at line 117 of file uint256.hpp.
|
constexpr |
Definition at line 542 of file uint256_impl.hpp.
|
constexpr |
Definition at line 537 of file uint256_impl.hpp.
Definition at line 507 of file uint256_impl.hpp.
Definition at line 173 of file uint256.hpp.
Definition at line 512 of file uint256_impl.hpp.
Definition at line 190 of file uint256.hpp.
Definition at line 401 of file uint256_impl.hpp.
Definition at line 163 of file uint256.hpp.
Definition at line 377 of file uint256_impl.hpp.
|
inlineconstexpr |
Definition at line 179 of file uint256.hpp.
Definition at line 153 of file uint256.hpp.
|
constexpr |
Definition at line 396 of file uint256_impl.hpp.
Definition at line 386 of file uint256_impl.hpp.
|
inlineconstexpr |
Definition at line 184 of file uint256.hpp.
Definition at line 158 of file uint256.hpp.
Definition at line 502 of file uint256_impl.hpp.
Definition at line 168 of file uint256.hpp.
|
constexpr |
Definition at line 562 of file uint256_impl.hpp.
Definition at line 620 of file uint256_impl.hpp.
|
inlineconstexpr |
Definition at line 211 of file uint256.hpp.
|
constexpr |
Definition at line 567 of file uint256_impl.hpp.
|
constexprdefaultnoexcept |
|
constexprdefaultnoexcept |
|
constexpr |
Definition at line 532 of file uint256_impl.hpp.
|
constexpr |
Definition at line 547 of file uint256_impl.hpp.
|
constexpr |
Definition at line 557 of file uint256_impl.hpp.
Definition at line 572 of file uint256_impl.hpp.
|
inlineconstexpr |
Definition at line 206 of file uint256.hpp.
Definition at line 517 of file uint256_impl.hpp.
Definition at line 195 of file uint256.hpp.
Definition at line 522 of file uint256_impl.hpp.
Definition at line 200 of file uint256.hpp.
|
constexpr |
Definition at line 527 of file uint256_impl.hpp.
Definition at line 338 of file uint256_impl.hpp.
|
staticconstexprprivate |
Definition at line 46 of file uint256_impl.hpp.
|
staticconstexprprivate |
Definition at line 56 of file uint256_impl.hpp.
|
constexpr |
Viewing this uint256_t as a bit string, and counting bits from 0, slices a substring.
start-th bit, to (but excluding) the end-th bit of this. Definition at line 330 of file uint256_impl.hpp.
|
staticconstexprprivate |
Convert from 4 64-bit limbs to 9 29-bit limbs.
Definition at line 116 of file uint256_impl.hpp.
|
staticconstexprprivate |
Multiply one limb by 9 limbs and add to resulting limbs.
Definition at line 89 of file uint256_impl.hpp.
| uint64_t bb::numeric::uint256_t::data[4] |
Definition at line 219 of file uint256.hpp.