pub fn position_after<'a, TBitCode: IntoIterator<Item=&'a BitCode>>(initial_pos: u64, bitcode: TBitCode) -> u64 {
        use self::BitCode::*;
        let mut pos = initial_pos;

        for code_point in bitcode {
            match code_point {
                Bits(num_bits, _value)                  => pos += *num_bits as u64,
                Move(new_pos)                           => pos = *new_pos,
                Align(_bit_count, _pattern, alignment)  => {
                    let alignment   = *alignment as u64;
                    let offset      = pos % alignment;
                    if offset != 0 { pos += alignment-offset }
                }
            }
        }

        pos
    }
///
/// Works out the new bit position after a particular set of bitcode has been evaluated
///
Works out the new bit position after a particular set of bitcode has been evaluated
Works out the new bit position after a particular set of bitcode has been evaluated
pub fn position_after<'a, TBitCode: IntoIterator<Item=&'a BitCode>>(initial_pos: u64, bitcode: TBitCode) -> u64 {
        use self::BitCode::*;
        let mut pos = initial_pos;
        for code_point in bitcode {
            match code_point {
                Bits(num_bits, _value)                  => pos += *num_bits as u64,
                Move(new_pos)                           => pos = *new_pos,
                Align(_bit_count, _pattern, alignment)  => {
                    let alignment   = *alignment as u64;
                    let offset      = pos % alignment;
                    if offset != 0 { pos += alignment-offset }
                }
            }
        }
        pos
    }
pub fn position_after < ' a , TBitCode : IntoIterator < Item = & ' a BitCode > > ( initial_pos : u64 , bitcode : TBitCode ) -> u64 { use self :: BitCode :: * ; let mut pos = initial_pos ; for code_point in bitcode { match code_point { Bits ( num_bits , _value ) => pos += * num_bits as u64 , Move ( new_pos ) => pos = * new_pos , Align ( _bit_count , _pattern , alignment ) => { let alignment = * alignment as u64 ; let offset = pos % alignment ; if offset != 0 { pos += alignment - offset } } } } pos }
Works out the new bit position after a particular set of bitcode has been evaluated
Works out the new bit position after a particular set of bitcode has been evaluated
initial_pos
u64
bitcode
TBitCode
initial_pos
u64
bitcode
TBitCode