From f2d31f89da51c9fcd7a60bae3f729e2ab6731127 Mon Sep 17 00:00:00 2001 From: Johannes Hengstler Date: Tue, 25 Jun 2024 20:14:14 +0200 Subject: [PATCH] code style --- src/bit_vec/fast_rs_vec/mod.rs | 2 +- src/bit_vec/fast_rs_vec/tests.rs | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/bit_vec/fast_rs_vec/mod.rs b/src/bit_vec/fast_rs_vec/mod.rs index a844e0c..92e04ae 100644 --- a/src/bit_vec/fast_rs_vec/mod.rs +++ b/src/bit_vec/fast_rs_vec/mod.rs @@ -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; diff --git a/src/bit_vec/fast_rs_vec/tests.rs b/src/bit_vec/fast_rs_vec/tests.rs index f442ce9..448de2b 100644 --- a/src/bit_vec/fast_rs_vec/tests.rs +++ b/src/bit_vec/fast_rs_vec/tests.rs @@ -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(); } } @@ -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)); } @@ -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); -} \ No newline at end of file +}