Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

reversing_partial_result

Reverses byte order with an existing partial result.

The step parameter MUST be a power of 2 (e.g., 2, 256, 65536). Using a non-power-of-2 step will produce incorrect results and data corruption. Valid steps: 2 (bits), 256 (bytes), 65536 (u16 words), etc.

Arguments

  • word - The value to reverse
  • onto - The existing partial result to build upon
  • size - The number of steps to perform
  • step - The step size for division/reconstruction (MUST be a power of 2)

Returns

  • (T, T) - Tuple containing the final reversed value and remaining value

Panics

  • If step is not a power of 2 (runtime check performed)

Fully qualified path: alexandria_data_structures::byte_appender::reversing_partial_result

pub fn reversing_partial_result<
    T,
    +Copy<T>,
    +DivRem<T>,
    +TryInto<T, NonZero<T>>,
    +Into<T, u128>,
    +TryInto<u128, T>,
    +Drop<T>,
    +MulAssign<T, T>,
    +Rem<T>,
    +AddAssign<T, T>,
>(
    mut word: T, mut onto: T, size: u32, step: T,
) -> (T, T)