diff --git a/src/runtime/polyp.rs b/src/runtime/polyp.rs index 0a343d9d92022e14fbac4b1b9bdeea322bc8e4c9..bf1a6b3014667770134ea579cc4e17045f2b8a39 100644 --- a/src/runtime/polyp.rs +++ b/src/runtime/polyp.rs @@ -254,12 +254,13 @@ impl Iterator for BitSetAndIter<'_> { shifty(&mut chunk, 02, &mut self.next_bit_index); shifty(&mut chunk, 01, &mut self.next_bit_index); // assert(chunk & 1 == 1) - let index = self.next_u32_index * 32 + self.next_bit_index; + self.next_bit_index += 1; self.cached = Some(chunk >> 1); if chunk > 0 { - // assert(self.next_bit_index <= 32) - // because index was calculated with self.next_bit_index - 1 + let index = self.next_u32_index * 32 + (self.next_bit_index - 1); + // assert((self.next_bit_index-1) < 32) + // because if chunk was shifted 32+ places, its contents would be zero. return Some(index); } }