// Counts the number of 1's in the bitvector up to position pos.
// pos is zero-based; count is one-based.
// E.g., for bitvector: 100101000, rank(3) = 2
Counts the number of 1's in the bitvector up to position pos.
pos is zero-based; count is one-based.
Counts the number of 1 ' s in the bitvector up to position pos . pos is zero - based ; count is one - based .
pub fn rank(&self, pos: position_t) -> position_t {
        let word_per_basic_block: position_t = self.basic_block_size / K_WORD_SIZE;
        let block_id: position_t = pos / self.basic_block_size;
        let offset: position_t = pos & (self.basic_block_size - 1);
        return self.rank_lut[block_id] + popcount_linear(self.bitvec.get_bits(), (block_id * word_per_basic_block) as u64, (offset + 1) as u64) as position_t;
    }
pub fn rank ( & self , pos : position_t ) -> position_t { let word_per_basic_block : position_t = self . basic_block_size / K_WORD_SIZE ; let block_id : position_t = pos / self . basic_block_size ; let offset : position_t = pos & ( self . basic_block_size - 1 ) ; return self . rank_lut [ block_id ] + popcount_linear ( self . bitvec . get_bits ( ) , ( block_id * word_per_basic_block ) as u64 , ( offset + 1 ) as u64 ) as position_t ; }
Counts the number of 1's in the bitvector up to position pos.
Counts the number of 1 ' s in the bitvector up to position pos .
&self
pos
position_t