Commit a36f5250 authored by Cyprien Borée's avatar Cyprien Borée

reallocate only once and fix indent/comment

For more informations see #3393.
parent ee5b6382
Pipeline #34464 failed with stages
in 2 minutes and 54 seconds
......@@ -27,12 +27,12 @@ void BinReadStorage::init(size_t nb_bins, size_t max_score, const VirtualReadSco
bins = NULL;
else
bins = new list<Sequence>[1];
score_bins = new double[1];
nb_scores = new size_t[1];
score_bins[0] = 0;
nb_scores[0] = 0;
scorer = vrs;
inited=true;
score_bins = new double[1];
nb_scores = new size_t[1];
score_bins[0] = 0;
nb_scores[0] = 0;
scorer = vrs;
inited=true;
}
void BinReadStorage::reallocate(){
......@@ -90,7 +90,11 @@ void BinReadStorage::add(Sequence &s) {
if (bin < (size_t)smallest_bin_not_empty)
smallest_bin_not_empty = bin;
} else {
reallocate();
// We don't have space left.
// Either we don't insert that sequence or it replaces another one
if(nb_inserted > nb_stored){
reallocate();
}
if (bin > smallest_bin_not_empty) {
bins[smallest_bin_not_empty].erase(bins[smallest_bin_not_empty].begin());
if (bins[smallest_bin_not_empty].size() == 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment