|
|
|
@ -1069,7 +1069,7 @@ pub struct BitBuffer(pub Vec<bool>);
|
|
|
|
|
|
|
|
|
|
impl BitBuffer {
|
|
|
|
|
// Appends the given number of low bits of the given value
|
|
|
|
|
// to this sequence. Requires 0 <= len <= 31 and 0 <= val < 2^len.
|
|
|
|
|
// to this sequence. Requires len <= 31 and 0 <= val < 2^len.
|
|
|
|
|
pub fn append_bits(&mut self, val: u32, len: u8) {
|
|
|
|
|
assert!(len <= 31 && (val >> len) == 0, "Value out of range");
|
|
|
|
|
self.0.extend((0 .. len as i32).rev().map(|i| get_bit(val, i))); // Append bit by bit
|
|
|
|
|