Function bitwise::word::copy_bit [] [src]

pub fn copy_bit<T: Word, U: UnsignedWord>(x: T,
                                          from_bit: U,
                                          y: T,
                                          to_bit: U)
                                          -> T

Copys the from_bit of x into y at to_bit.

Panics

If bit >= bit_size() or pos >= bit_size().

Examples

use bitwise::word::*;

let a  = 0b1011_0010u8;
let b  = 0b1001_0010u8;
let c  = 0b1111_0010u8;
assert_eq!(a.copy_bit(5u8, b, 5u8), a);
assert_eq!(copy_bit(a, 6u8, c, 6u8), a);