Skip to content

Commit

Permalink
code style
Browse files Browse the repository at this point in the history
  • Loading branch information
Cydhra committed Jun 25, 2024
1 parent e9d5563 commit f2d31f8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/bit_vec/fast_rs_vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ impl<'a, const ZERO: bool> SelectIter<'a, ZERO> {
// OR if the next block has a rank higher than the current rank
if self.last_block % (SUPER_BLOCK_SIZE / BLOCK_SIZE) == 15
|| self.vec.blocks.len() > self.last_block + 1
&& self.vec.blocks[self.last_block + 1].zeros as usize > rank
&& self.vec.blocks[self.last_block + 1].zeros as usize > rank
{
// instantly jump to the last searched position
block_index = self.last_block;
Expand Down
17 changes: 13 additions & 4 deletions src/bit_vec/fast_rs_vec/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -645,8 +645,17 @@ fn test_construction() {
if block_index % (SUPER_BLOCK_SIZE / BLOCK_SIZE) == 0 {
zero_counter = 0;
}
assert_eq!(zero_counter, block.zeros as u32, "zero count mismatch in block {} of {}", block_index, bv.blocks.len());
for word in bv.data[block_index * BLOCK_SIZE / WORD_SIZE..].iter().take(BLOCK_SIZE / WORD_SIZE) {
assert_eq!(
zero_counter,
block.zeros as u32,
"zero count mismatch in block {} of {}",
block_index,
bv.blocks.len()
);
for word in bv.data[block_index * BLOCK_SIZE / WORD_SIZE..]
.iter()
.take(BLOCK_SIZE / WORD_SIZE)
{
zero_counter += word.count_zeros();
}
}
Expand All @@ -662,7 +671,7 @@ fn test_select_iter_regression_i6() {
6, 7,
]);
let sample = Uniform::new(0, 2);

for _ in 0..LENGTH {
bv.append_bit(sample.sample(&mut rng));
}
Expand All @@ -682,4 +691,4 @@ fn test_select_iter_regression_i6() {
let mut all_bits: Vec<_> = bv.iter0().chain(bv.iter1()).collect();
all_bits.sort();
assert_eq!(all_bits.len(), LENGTH);
}
}

0 comments on commit f2d31f8

Please sign in to comment.