Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

OptBitShift

Optimized bit shift trait.

Fully qualified path: alexandria_math::opt_math::OptBitShift

pub trait OptBitShift<T, +WideMul<T, T>>

Trait functions

shl

Optimized left bit shift of x by y up to T.bits - 1.

Arguments

  • x - Value to be shifted.
  • y - Number of shifts.

Returns

  • T - result of left shift

Fully qualified path: alexandria_math::opt_math::OptBitShift::shl

fn shl(x: T, n: u8) -> T

shr

Optimized right bit shift of x by y up to T.bits - 1.

Arguments

  • x - Value to be shifted.
  • y - Number of shifts.

Returns

  • T - result of left shift

Fully qualified path: alexandria_math::opt_math::OptBitShift::shr

fn shr(x: T, n: u8) -> T