fn update_position(
    start_pos: &mut usize,
    kmer: &mut BitKmer,
    buffer: &[u8],
    initial: bool,
) -> bool {
    // check if we have enough "physical" space for one more kmer
    if *start_pos + kmer.1 as usize > buffer.len() {
        return false;
    }

    let (mut kmer_len, stop_len) = if initial {
        (0, (kmer.1 - 1) as usize)
    } else {
        ((kmer.1 - 1) as usize, kmer.1 as usize)
    };

    let mut cur_kmer = kmer;
    while kmer_len < stop_len {
        if extend_kmer(&mut cur_kmer, buffer[*start_pos + kmer_len]) {
            kmer_len += 1;
        } else {
            kmer_len = 0;
            *cur_kmer = (0u64, cur_kmer.1);
            *start_pos += kmer_len + 1;
            if *start_pos + cur_kmer.1 as usize > buffer.len() {
                return false;
            }
        }
    }
    true
}
/// Used for the BitNuclKmer iterator to handle skipping invalid bases.
Used for the BitNuclKmer iterator to handle skipping invalid bases.
Used for the BitNuclKmer iterator to handle skipping invalid bases .
fn update_position(
    start_pos: &mut usize,
    kmer: &mut BitKmer,
    buffer: &[u8],
    initial: bool,
) -> bool {
    // check if we have enough "physical" space for one more kmer
    if *start_pos + kmer.1 as usize > buffer.len() {
        return false;
    }
    let (mut kmer_len, stop_len) = if initial {
        (0, (kmer.1 - 1) as usize)
    } else {
        ((kmer.1 - 1) as usize, kmer.1 as usize)
    };
    let mut cur_kmer = kmer;
    while kmer_len < stop_len {
        if extend_kmer(&mut cur_kmer, buffer[*start_pos + kmer_len]) {
            kmer_len += 1;
        } else {
            kmer_len = 0;
            *cur_kmer = (0u64, cur_kmer.1);
            *start_pos += kmer_len + 1;
            if *start_pos + cur_kmer.1 as usize > buffer.len() {
                return false;
            }
        }
    }
    true
}
fn update_position ( start_pos : & mut usize , kmer : & mut BitKmer , buffer : & [ u8 ] , initial : bool , ) -> bool { // check if we have enough "physical" space for one more kmer if * start_pos + kmer . 1 as usize > buffer . len ( ) { return false ; } let ( mut kmer_len , stop_len ) = if initial { ( 0 , ( kmer . 1 - 1 ) as usize ) } else { ( ( kmer . 1 - 1 ) as usize , kmer . 1 as usize ) } ; let mut cur_kmer = kmer ; while kmer_len < stop_len { if extend_kmer ( & mut cur_kmer , buffer [ * start_pos + kmer_len ] ) { kmer_len += 1 ; } else { kmer_len = 0 ; * cur_kmer = ( 0u64 , cur_kmer . 1 ) ; * start_pos += kmer_len + 1 ; if * start_pos + cur_kmer . 1 as usize > buffer . len ( ) { return false ; } } } true }
Used for the BitNuclKmer iterator to handle skipping invalid bases.
Used for the BitNuclKmer iterator to handle skipping invalid bases .
start_pos
&mut usize
kmer
&mut BitKmer
buffer
&[u8]
initial
bool