Function bitwise::word::shift_logical_right [] [src]

pub fn shift_logical_right<T: Word, U: Word>(x: T, n: U) -> T

Shift the bits of x to the right n; the high-order bits of the result are cleared.

Panics

If n > bit_size().

Examples

use bitwise::word::*;

let a = 0b0111_0000u8;
let b = 0b1001_0000u8;

assert_eq!(a.shift_logical_right(4), 0b0000_0111u8);
assert_eq!(shift_logical_right(b, 4), 0b0000_1001u8);
b.shift_logical_right((u8::bit_size() - 1));