Files
xahaud/include/xrpl/basics
Alphonse Mousse 1f575aa3f6 Improve base_uint:
This commit makes several changes to the base_uint class, which was
originally taken from Bitcoin and has already been heavily modified
by Ripple engineers.

It introduces conditional widening of the internal limb type, going
from 32 to 64 bits if the requested number of bits is a multiple of
64. This change alone halves iteration counts for common operations
and, combined with use of add-with-carry compiler intrinsics, helps
leverage modern processor resources more effectively.

Other changes include:

 - Extracting the arithmetic operations into free helper functions
   which operate on the limb array directly.
 - Replacing the SFINAE-based is_contiguous_container trait with a
   byte_copy_source concept.
 - Rewriting the hex parsing around a consteval lookup table and a
   simple left-to-right loop, replacing the old shift-based nibble
   accumulator.
 - Using memmove instead of memcpy when copying to avoid UB in the
   unlikely case where the source and destination buffers overlap.
 - Eliminating a workaround in operator<=> to handle MacOS quirks.
 - Removing redundant parseHex overloads and introducing from_hex
   as a factory function.
 - Introducing a tagless_compare() for cross-tag comparison.
 - Adding noexcept, [[nodiscard]], and constexpr throughout.
2026-09-23 13:03:28 +10:00
..
2026-02-20 07:11:12 +09:00
2026-02-20 07:11:12 +09:00
2026-02-20 07:11:12 +09:00
2026-09-23 13:03:28 +10:00
2026-02-20 08:09:43 +09:00
2026-02-20 07:11:12 +09:00
2026-02-20 07:11:12 +09:00
2026-02-20 07:11:13 +09:00
2026-02-20 07:11:12 +09:00
2026-02-20 07:11:13 +09:00
2026-09-23 13:03:28 +10:00
2026-02-20 07:11:12 +09:00
2026-02-20 07:11:12 +09:00
2026-02-20 07:11:13 +09:00
2026-02-20 07:11:12 +09:00
2026-02-20 07:11:13 +09:00
2026-02-20 07:11:12 +09:00
2026-02-20 07:11:12 +09:00
2026-02-20 07:11:12 +09:00
2026-02-20 07:11:13 +09:00
2026-02-20 07:11:12 +09:00
2026-02-20 07:11:13 +09:00
2026-02-20 07:11:13 +09:00
2026-02-20 07:26:21 +09:00
2026-09-23 13:03:28 +10:00
2026-09-23 13:03:28 +10:00
2026-09-23 13:03:28 +10:00
2026-02-20 07:11:12 +09:00
2026-02-20 07:11:13 +09:00
2026-02-20 07:11:13 +09:00
2026-02-20 07:11:12 +09:00
2026-02-20 07:11:13 +09:00
2026-02-20 07:11:12 +09:00

Basics

Utility functions and classes.

ripple/basic should contain no dependencies on other modules.

Choosing a rippled container.

  • std::vector

    • For ordered containers with most insertions or erases at the end.
  • std::deque

    • For ordered containers with most insertions or erases at the start or end.
  • std::list

    • For ordered containers with inserts and erases to the middle.
    • For containers with iterators stable over insert and erase.
    • Generally slower and bigger than std::vector or std::deque except for those cases.
  • std::set

    • For sorted containers.
  • ripple::hash_set

    • Where inserts and contains need to be O(1).
    • For "small" sets, std::set might be faster and smaller.
  • ripple::hardened_hash_set

The following container is deprecated

  • std::unordered_set
  • Use ripple::hash_set instead, which uses a better hashing algorithm.
  • Or use ripple::hardened_hash_set to prevent algorithmic complexity attacks.