Fix over-allocation of memory for dense U section of matrix

The previous code had an off by one error leading to an extra word being
allocated for each row
This commit is contained in:
Christopher Berner 2020-11-28 17:11:32 -08:00
parent 3a4068a726
commit 6245ab1c9a

@ -262,7 +262,7 @@ impl BinaryMatrix for SparseBinaryMatrix {
);
assert_eq!(self.column_index_disabled, false);
self.num_dense_columns += 1;
let (last_word, last_bit) = self.bit_position(self.height, self.num_dense_columns - 1);
let (last_word, last_bit) = self.bit_position(self.height - 1, self.num_dense_columns - 1);
// If this is in a new word
if last_bit == 0 && last_word >= self.dense_elements.len() {
// Append a new set of words