Don't forget to initialize cells[0]

This commit is contained in:
2019-10-09 21:52:57 +02:00
parent cc65735b88
commit a172f5ee3f

View File

@@ -55,9 +55,11 @@ where
// result as this is the max number of elements per bucket.
let max_offset = (distinct.len() / (1 << cell_bits)) + 1;
// Do not forget to initialise cells[0]
let mut cells: Vec<Cell<V>> = Vec::with_capacity(1 << cell_bits);
// Do not forget to initialise cells[0]!
cells.push(Vec::with_capacity(max_offset));
for coordinate in distinct {
//trace!("{:?} {:?} {:?} {:?}", dimension, coordinate, cell, count);