fn extend_blocks(&mut self, other: &Vob<T>, block_offset: usize) {
        debug_assert!(block_offset * bits_per_block::<T>() <= other.len(),);
        debug_assert_eq!(self.vec.len(), blocks_required::<T>(self.len));
        self.reserve(other.len());
        // used bits in last block
        let ub = self.len % bits_per_block::<T>();
        if ub == 0 {
            // If there are no unused bits, we can just push the new blocks
            self.vec.extend(other.vec.iter().skip(block_offset));
        } else {
            // We need to do things very carefully here. We need to shift each block ub to the
            // left. We use rotate to move those bits to the bottom part of the integer. Then we
            // add the bytes to the last block of this one.
            //
            // We're relying on the bit ordering here. We're also relying on the last bits to be 0.

            // this mask has the last ub bits set
            let msk = (T::one() << ub) - T::one();

            for block in other.vec.iter().skip(block_offset) {
                // rotate block to the left
                let new_block: T = block.rotate_left(ub as u32);
                {
                    let last = self.vec.last_mut().unwrap();
                    debug_assert_eq!(*last & !msk, T::zero());
                    // add the last (upper) bits of new_block
                    // ex: ub=4; 0000101 | 1110111 & !(0001111)
                    //   =>      0000101 | 1110000 => 1110101
                    *last = *last | new_block & !msk;
                }
                // add the last block with the lower (first) bits set
                self.vec.push(new_block & msk);
            }
        }

        // Compute new length for self.
        let new_len = self
            .len
            //  the subtraction won't overflow because of the bounds assumption above.
            .checked_add(other.len() - block_offset * bits_per_block::<T>())
            .expect("Overflow detected");

        // We need to truncate because we always push the last block from other even if it's empty.
        self.vec.truncate(blocks_required::<T>(new_len));

        // correct len
        self.len = new_len;
        self.mask_last_block();
    }
/// Copy entire blocks from other into self, respecting offset.
///
/// block_offset * bits_per_block should be less than other.len
Copy entire blocks from other into self, respecting offset.
block_offset * bits_per_block should be less than other.len
Copy entire blocks from other into self respecting offset . block_offset * bits_per_block should be less than other . len
fn extend_blocks(&mut self, other: &Vob<T>, block_offset: usize) {
        debug_assert!(block_offset * bits_per_block::<T>() <= other.len(),);
        debug_assert_eq!(self.vec.len(), blocks_required::<T>(self.len));
        self.reserve(other.len());
        // used bits in last block
        let ub = self.len % bits_per_block::<T>();
        if ub == 0 {
            // If there are no unused bits, we can just push the new blocks
            self.vec.extend(other.vec.iter().skip(block_offset));
        } else {
            // We need to do things very carefully here. We need to shift each block ub to the
            // left. We use rotate to move those bits to the bottom part of the integer. Then we
            // add the bytes to the last block of this one.
            //
            // We're relying on the bit ordering here. We're also relying on the last bits to be 0.
            // this mask has the last ub bits set
            let msk = (T::one() << ub) - T::one();
            for block in other.vec.iter().skip(block_offset) {
                // rotate block to the left
                let new_block: T = block.rotate_left(ub as u32);
                {
                    let last = self.vec.last_mut().unwrap();
                    debug_assert_eq!(*last & !msk, T::zero());
                    // add the last (upper) bits of new_block
                    // ex: ub=4; 0000101 | 1110111 & !(0001111)
                    //   =>      0000101 | 1110000 => 1110101
                    *last = *last | new_block & !msk;
                }
                // add the last block with the lower (first) bits set
                self.vec.push(new_block & msk);
            }
        }
        // Compute new length for self.
        let new_len = self
            .len
            //  the subtraction won't overflow because of the bounds assumption above.
            .checked_add(other.len() - block_offset * bits_per_block::<T>())
            .expect("Overflow detected");
        // We need to truncate because we always push the last block from other even if it's empty.
        self.vec.truncate(blocks_required::<T>(new_len));
        // correct len
        self.len = new_len;
        self.mask_last_block();
    }
fn extend_blocks ( & mut self , other : & Vob < T > , block_offset : usize ) { debug_assert ! ( block_offset bits_per_block T ( ) other len ( ) ) ; debug_assert_eq ! ( self vec len ( ) blocks_required T ( self len ) ) ; self . reserve ( other . len ( ) ) ; // used bits in last block let ub = self . len % bits_per_block :: < T > ( ) ; if ub == 0 { // If there are no unused bits, we can just push the new blocks self . vec . extend ( other . vec . iter ( ) . skip ( block_offset ) ) ; } else { // We need to do things very carefully here. We need to shift each block ub to the // left. We use rotate to move those bits to the bottom part of the integer. Then we // add the bytes to the last block of this one. // // We're relying on the bit ordering here. We're also relying on the last bits to be 0. // this mask has the last ub bits set let msk = ( T :: one ( ) << ub ) - T :: one ( ) ; for block in other . vec . iter ( ) . skip ( block_offset ) { // rotate block to the left let new_block : T = block . rotate_left ( ub as u32 ) ; { let last = self . vec . last_mut ( ) . unwrap ( ) ; debug_assert_eq ! ( last msk T zero ( ) ) ; // add the last (upper) bits of new_block // ex: ub=4; 0000101 | 1110111 & !(0001111) //   =>      0000101 | 1110000 => 1110101 * last = * last | new_block & ! msk ; } // add the last block with the lower (first) bits set self . vec . push ( new_block & msk ) ; } } // Compute new length for self. let new_len = self . len //  the subtraction won't overflow because of the bounds assumption above. . checked_add ( other . len ( ) - block_offset * bits_per_block :: < T > ( ) ) . expect ( " " ) ; // We need to truncate because we always push the last block from other even if it's empty. self . vec . truncate ( blocks_required :: < T > ( new_len ) ) ; // correct len self . len = new_len ; self . mask_last_block ( ) ; }
Copy entire blocks from other into self, respecting offset.
Copy entire blocks from other into self respecting offset .
&mut self
other
&Vob<T>
block_offset
usize
&mut self
other
&Vob<T>
block_offset
usize