lexical_write_integer::algorithm

Function algorithm_u128

Source
pub fn algorithm_u128<const FORMAT: u128, const MASK: u128, const SHIFT: i32>(
    value: u128,
    table: &[u8],
    buffer: &mut [u8],
) -> usize
Expand description

Optimized implementation for radix-N 128-bit numbers.

ยงSafety

Safe as long as digit_count returns the number of written digits. For performance reasons, this is always calculated as the exact number of digits. If the value is too small, then the buffer will underflow, causing out-of-bounds read/writes. Care must be used that digit_count is correctly implemented.

Since digit_count is implemented as an unsafe trait, these guarantees must be held.

See the crate crate documentation for more security considerations.