pub fn separate_bytes_fragments(source: &mut [u8]) {
        // TODO without extra allocation?
        let mut first_half = Vec::with_capacity(source.len() / 2);
        let mut second_half = Vec::with_capacity(source.len() / 2);
        let mut interleaved_index = 0;

        // TODO rustify!
        loop {
            if interleaved_index < source.len() {
                first_half.push(source[interleaved_index]); // index unsafe but handled with care and unit-tested
                interleaved_index += 1;

            } else { break; }

            if interleaved_index < source.len() {
                second_half.push(source[interleaved_index]); // index unsafe but handled with care and unit-tested
                interleaved_index += 1;

            } else { break; }
        }

        let mut result = first_half;
        result.append(&mut second_half);
        source.copy_from_slice(result.as_slice());
    }
/// Separate the bytes such that the second half contains each other byte.
Separate the bytes such that the second half contains each other byte.
Separate the bytes such that the second half contains each other byte .
pub fn separate_bytes_fragments(source: &mut [u8]) {
        // TODO without extra allocation?
        let mut first_half = Vec::with_capacity(source.len() / 2);
        let mut second_half = Vec::with_capacity(source.len() / 2);
        let mut interleaved_index = 0;
        // TODO rustify!
        loop {
            if interleaved_index < source.len() {
                first_half.push(source[interleaved_index]); // index unsafe but handled with care and unit-tested
                interleaved_index += 1;
            } else { break; }
            if interleaved_index < source.len() {
                second_half.push(source[interleaved_index]); // index unsafe but handled with care and unit-tested
                interleaved_index += 1;
            } else { break; }
        }
        let mut result = first_half;
        result.append(&mut second_half);
        source.copy_from_slice(result.as_slice());
    }
pub fn separate_bytes_fragments ( source : & mut [ u8 ] ) { // TODO without extra allocation? let mut first_half = Vec :: with_capacity ( source . len ( ) / 2 ) ; let mut second_half = Vec :: with_capacity ( source . len ( ) / 2 ) ; let mut interleaved_index = 0 ; // TODO rustify! loop { if interleaved_index < source . len ( ) { first_half . push ( source [ interleaved_index ] ) ; // index unsafe but handled with care and unit-tested interleaved_index += 1 ; } else { break ; } if interleaved_index < source . len ( ) { second_half . push ( source [ interleaved_index ] ) ; // index unsafe but handled with care and unit-tested interleaved_index += 1 ; } else { break ; } } let mut result = first_half ; result . append ( & mut second_half ) ; source . copy_from_slice ( result . as_slice ( ) ) ; }
Separate the bytes such that the second half contains each other byte.
Separate the bytes such that the second half contains each other byte .
source
&mut [u8]
source
&mut [u8]