|
xrpld
|
Integers of any length that is a multiple of 32-bits. More...
#include <base_uint.h>

Classes | |
| struct | VoidHelper |
| Construct from a raw pointer. More... | |
Public Types | |
| using | size_type = std::size_t |
| using | difference_type = std::ptrdiff_t |
| using | value_type = unsigned char |
| using | pointer = value_type* |
| using | reference = value_type& |
| using | const_pointer = value_type const* |
| using | const_reference = value_type const& |
| using | iterator = pointer |
| using | const_iterator = const_pointer |
| using | reverse_iterator = std::reverse_iterator<iterator> |
| using | const_reverse_iterator = std::reverse_iterator<const_iterator> |
| using | tag_type = Tag |
| using | hasher = HardenedHash<> |
| Value hashing function. | |
Public Member Functions | |
| pointer | data () |
| const_pointer | data () const |
| iterator | begin () |
| iterator | end () |
| const_iterator | begin () const |
| const_iterator | end () const |
| const_iterator | cbegin () const |
| const_iterator | cend () const |
| constexpr | BaseUInt () |
| constexpr | BaseUInt (beast::Zero) |
| BaseUInt (std::uint64_t b) | |
| constexpr | BaseUInt (std::string_view sv) noexcept(false) |
| template<class Container> requires ( detail::IsContiguousContainer<Container>::value && std::is_trivially_copyable_v<typename Container::value_type>) | |
| BaseUInt (Container const &c) | |
| template<class Container> requires ( detail::IsContiguousContainer<Container>::value && std::is_trivially_copyable_v<typename Container::value_type>) | |
| BaseUInt & | operator= (Container const &c) |
| constexpr int | signum () const |
| bool | operator! () const |
| constexpr BaseUInt | operator~ () const |
| BaseUInt & | operator= (std::uint64_t uHost) |
| BaseUInt & | operator^= (BaseUInt const &b) |
| BaseUInt & | operator&= (BaseUInt const &b) |
| BaseUInt & | operator|= (BaseUInt const &b) |
| BaseUInt & | operator++ () |
| BaseUInt | operator++ (int) |
| BaseUInt & | operator-- () |
| BaseUInt | operator-- (int) |
| BaseUInt | next () const |
| BaseUInt | prev () const |
| BaseUInt & | operator+= (BaseUInt const &b) |
| constexpr bool | parseHex (std::string_view sv) |
| Parse a hex string into a base_uint. | |
| constexpr bool | parseHex (char const *str) |
| bool | parseHex (std::string const &str) |
| BaseUInt< Bits, Tag > & | operator= (beast::Zero) |
| bool | isZero () const |
| bool | isNonZero () const |
| void | zero () |
Static Public Member Functions | |
| template<class Container> requires ( detail::IsContiguousContainer<Container>::value && std::is_trivially_copyable_v<typename Container::value_type>) | |
| static BaseUInt | fromRaw (Container const &c) |
| static BaseUInt | fromVoid (void const *data) |
| template<class T> | |
| static std::optional< BaseUInt > | fromVoidChecked (T const &from) |
| static constexpr std::size_t | size () |
Static Public Attributes | |
| static constexpr std::size_t | kBytes = Bits / 8 |
Private Types | |
| enum class | ParseResult { Okay , BadLength , BadChar } |
Private Member Functions | |
| BaseUInt (void const *data, VoidHelper) | |
| constexpr std::expected< decltype(data_), ParseResult > | parseFromStringView (std::string_view sv) noexcept |
| constexpr decltype(data_) | parseFromStringViewThrows (std::string_view sv) noexcept(false) |
Private Attributes | |
| std::array< std::uint32_t, kWidth > | data_ |
Static Private Attributes | |
| static constexpr std::size_t | kWidth = Bits / 32 |
Friends | |
| template<class Hasher> | |
| void | hash_append (Hasher &h, BaseUInt const &a) noexcept |
Integers of any length that is a multiple of 32-bits.
| Bits | The number of bits this integer should have; must be at least 64 and a multiple of 32. |
| Tag | An arbitrary type that functions as a tag and allows the instantiation of "distinct" types that the same number of bits. |
Definition at line 81 of file base_uint.h.
| using xrpl::BaseUInt< Bits, Tag >::size_type = std::size_t |
Definition at line 103 of file base_uint.h.
| using xrpl::BaseUInt< Bits, Tag >::difference_type = std::ptrdiff_t |
Definition at line 104 of file base_uint.h.
| using xrpl::BaseUInt< Bits, Tag >::value_type = unsigned char |
Definition at line 105 of file base_uint.h.
| using xrpl::BaseUInt< Bits, Tag >::pointer = value_type* |
Definition at line 106 of file base_uint.h.
| using xrpl::BaseUInt< Bits, Tag >::reference = value_type& |
Definition at line 107 of file base_uint.h.
| using xrpl::BaseUInt< Bits, Tag >::const_pointer = value_type const* |
Definition at line 108 of file base_uint.h.
| using xrpl::BaseUInt< Bits, Tag >::const_reference = value_type const& |
Definition at line 109 of file base_uint.h.
| using xrpl::BaseUInt< Bits, Tag >::iterator = pointer |
Definition at line 110 of file base_uint.h.
| using xrpl::BaseUInt< Bits, Tag >::const_iterator = const_pointer |
Definition at line 111 of file base_uint.h.
| using xrpl::BaseUInt< Bits, Tag >::reverse_iterator = std::reverse_iterator<iterator> |
Definition at line 112 of file base_uint.h.
| using xrpl::BaseUInt< Bits, Tag >::const_reverse_iterator = std::reverse_iterator<const_iterator> |
Definition at line 113 of file base_uint.h.
| using xrpl::BaseUInt< Bits, Tag >::tag_type = Tag |
Definition at line 114 of file base_uint.h.
| using xrpl::BaseUInt< Bits, Tag >::hasher = HardenedHash<> |
Value hashing function.
The seed prevents crafted inputs from causing degenerate parent containers.
Definition at line 163 of file base_uint.h.
|
strongprivate |
| Enumerator | |
|---|---|
| Okay | |
| BadLength | |
| BadChar | |
Definition at line 187 of file base_uint.h.
|
explicitprivate |
Definition at line 181 of file base_uint.h.
|
constexpr |
Definition at line 265 of file base_uint.h.
|
constexpr |
Definition at line 269 of file base_uint.h.
|
explicit |
Definition at line 273 of file base_uint.h.
|
explicitconstexpr |
Definition at line 281 of file base_uint.h.
|
explicit |
Definition at line 287 of file base_uint.h.
| pointer xrpl::BaseUInt< Bits, Tag >::data | ( | ) |
Definition at line 117 of file base_uint.h.
|
nodiscard |
Definition at line 122 of file base_uint.h.
| iterator xrpl::BaseUInt< Bits, Tag >::begin | ( | ) |
Definition at line 128 of file base_uint.h.
| iterator xrpl::BaseUInt< Bits, Tag >::end | ( | ) |
Definition at line 133 of file base_uint.h.
|
nodiscard |
Definition at line 138 of file base_uint.h.
|
nodiscard |
Definition at line 143 of file base_uint.h.
|
nodiscard |
Definition at line 148 of file base_uint.h.
|
nodiscard |
Definition at line 153 of file base_uint.h.
|
constexprprivatenoexcept |
Definition at line 194 of file base_uint.h.
|
constexprprivate |
Definition at line 251 of file base_uint.h.
|
static |
Definition at line 302 of file base_uint.h.
| BaseUInt & xrpl::BaseUInt< Bits, Tag >::operator= | ( | Container const & | c | ) |
Definition at line 319 of file base_uint.h.
|
static |
Definition at line 339 of file base_uint.h.
|
static |
Definition at line 346 of file base_uint.h.
|
nodiscardconstexpr |
Definition at line 354 of file base_uint.h.
| bool xrpl::BaseUInt< Bits, Tag >::operator! | ( | ) | const |
Definition at line 366 of file base_uint.h.
|
constexpr |
Definition at line 372 of file base_uint.h.
| BaseUInt & xrpl::BaseUInt< Bits, Tag >::operator= | ( | std::uint64_t | uHost | ) |
Definition at line 383 of file base_uint.h.
| BaseUInt & xrpl::BaseUInt< Bits, Tag >::operator^= | ( | BaseUInt< Bits, Tag > const & | b | ) |
Definition at line 401 of file base_uint.h.
| BaseUInt & xrpl::BaseUInt< Bits, Tag >::operator&= | ( | BaseUInt< Bits, Tag > const & | b | ) |
Definition at line 410 of file base_uint.h.
| BaseUInt & xrpl::BaseUInt< Bits, Tag >::operator|= | ( | BaseUInt< Bits, Tag > const & | b | ) |
Definition at line 419 of file base_uint.h.
| BaseUInt & xrpl::BaseUInt< Bits, Tag >::operator++ | ( | ) |
Definition at line 428 of file base_uint.h.
| BaseUInt xrpl::BaseUInt< Bits, Tag >::operator++ | ( | int | ) |
Definition at line 442 of file base_uint.h.
| BaseUInt & xrpl::BaseUInt< Bits, Tag >::operator-- | ( | ) |
Definition at line 452 of file base_uint.h.
| BaseUInt xrpl::BaseUInt< Bits, Tag >::operator-- | ( | int | ) |
Definition at line 467 of file base_uint.h.
|
nodiscard |
Definition at line 477 of file base_uint.h.
|
nodiscard |
Definition at line 484 of file base_uint.h.
| BaseUInt & xrpl::BaseUInt< Bits, Tag >::operator+= | ( | BaseUInt< Bits, Tag > const & | b | ) |
Definition at line 491 of file base_uint.h.
|
nodiscardconstexpr |
Parse a hex string into a base_uint.
The input must be precisely 2 * bytes hexadecimal characters long, with one exception: the value '0'.
| sv | A null-terminated string of hexadecimal characters |
Definition at line 525 of file base_uint.h.
|
nodiscardconstexpr |
Definition at line 536 of file base_uint.h.
|
nodiscard |
Definition at line 542 of file base_uint.h.
|
staticconstexpr |
Definition at line 548 of file base_uint.h.
| BaseUInt< Bits, Tag > & xrpl::BaseUInt< Bits, Tag >::operator= | ( | beast::Zero | ) |
Definition at line 554 of file base_uint.h.
|
nodiscard |
Definition at line 562 of file base_uint.h.
|
nodiscard |
Definition at line 567 of file base_uint.h.
| void xrpl::BaseUInt< Bits, Tag >::zero | ( | ) |
Definition at line 572 of file base_uint.h.
|
friend |
Definition at line 509 of file base_uint.h.
|
staticconstexprprivate |
Definition at line 87 of file base_uint.h.
|
private |
Definition at line 92 of file base_uint.h.
|
staticconstexpr |
Definition at line 100 of file base_uint.h.