Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

BitRotate

Rotate the bits of an unsigned integer of type T

Fully qualified path: alexandria_math::BitRotate

pub trait BitRotate<T>

Trait functions

rotate_left

Take the bits of an unsigned integer and rotate in the left direction

Arguments

  • x - rotate its bit representation in the leftward direction
  • n - number of steps to rotate

Returns

  • T - the result of rotating the bits of number x left, n number of steps

Fully qualified path: alexandria_math::BitRotate::rotate_left

fn rotate_left(x: T, n: T) -> T

rotate_right

Take the bits of an unsigned integer and rotate in the right direction

Arguments

  • x - rotate its bit representation in the rightward direction
  • n - number of steps to rotate

Returns

  • T - the result of rotating the bits of number x right, n number of steps

Fully qualified path: alexandria_math::BitRotate::rotate_right

fn rotate_right(x: T, n: T) -> T