fn section_proc(section: &Section) -> u64 {
    let mut sub_sec_result;
    let mut result: u64 = 0;
    if section.is_specified {
        return section.specified_val;
    }

    if section.sub_secs.is_empty() {
        let mut rng = rand::thread_rng();
        let mut max: u64 = 0xFF;
        for _ in 0..section.num_bytes {
            max <<= 8;
            max += 0xFF;
        }
        return rng.gen_range(0..max);
    }

    for i in 0..section.sub_secs.len() {
        sub_sec_result = sub_sec_proc(&section.sub_secs[i]);
        //shifting the bits to make room for the new result
        result <<= section.sub_secs[i].num_bits;
        //ORing to add the new result on the end
        result |= sub_sec_result as u64;
    }
    result
}
/// Process a given message format section
/// Returns u64 represenation of data generated
Process a given message format section
Returns u64 represenation of data generated
Process a given message format section Returns u64 represenation of data generated
fn section_proc(section: &Section) -> u64 {
    let mut sub_sec_result;
    let mut result: u64 = 0;
    if section.is_specified {
        return section.specified_val;
    }
    if section.sub_secs.is_empty() {
        let mut rng = rand::thread_rng();
        let mut max: u64 = 0xFF;
        for _ in 0..section.num_bytes {
            max <<= 8;
            max += 0xFF;
        }
        return rng.gen_range(0..max);
    }
    for i in 0..section.sub_secs.len() {
        sub_sec_result = sub_sec_proc(&section.sub_secs[i]);
        //shifting the bits to make room for the new result
        result <<= section.sub_secs[i].num_bits;
        //ORing to add the new result on the end
        result |= sub_sec_result as u64;
    }
    result
}
fn section_proc ( section : & Section ) -> u64 { let mut sub_sec_result ; let mut result : u64 = 0 ; if section . is_specified { return section . specified_val ; } if section . sub_secs . is_empty ( ) { let mut rng = rand :: thread_rng ( ) ; let mut max : u64 = 0xFF ; for _ in 0 .. section . num_bytes { max <<= 8 ; max += 0xFF ; } return rng . gen_range ( 0 .. max ) ; } for i in 0 .. section . sub_secs . len ( ) { sub_sec_result = sub_sec_proc ( & section . sub_secs [ i ] ) ; //shifting the bits to make room for the new result result <<= section . sub_secs [ i ] . num_bits ; //ORing to add the new result on the end result |= sub_sec_result as u64 ; } result }
Process a given message format section
Returns u64 represenation of data generated
Process a given message format section Returns u64 represenation of data generated
section
&Section
section
&Section