Skip to content

Commit

Permalink
Fixes that the mcs implementation gave different results depending on…
Browse files Browse the repository at this point in the history
… the -b parameter value
  • Loading branch information
ksahlin authored and Itolstoganov committed Apr 19, 2024
1 parent 5263222 commit eee0cd8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/index.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ struct StrobemerIndex {
randstrobes.begin() + position_end,
RefRandstrobe{key, 0, 0},
cmp);
if (pos->hash == key) return pos - randstrobes.begin();
if (pos->hash >> aux_len == key_prefix) return pos - randstrobes.begin();
return end();
}

Expand Down
10 changes: 5 additions & 5 deletions src/nam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ inline void add_to_hits_per_ref_partial(
adj_ref_start = index.get_strobe1_position(position) + index.strobe2_offset(position);
}
adj_ref_end = adj_ref_start + index.k();
int diff = std::abs((query_end - query_start) - (adj_ref_end - adj_ref_start));
if (diff <= min_diff) {
// int diff = std::abs((query_end - query_start) - (adj_ref_end - adj_ref_start));
// if (diff <= min_diff) {
hits_per_ref[index.reference_index(position)].push_back(
Hit{query_start, query_end, adj_ref_start, adj_ref_end}
);
min_diff = diff;
}
// min_diff = diff;
// }
}
}

Expand Down Expand Up @@ -211,7 +211,7 @@ std::pair<float, std::vector<Nam>> find_nams(
size_t partial_pos = index.partial_find(q.hash);
if (partial_pos != index.end()) {
total_hits++;
if (index.is_partial_filtered(position)) {
if (index.is_partial_filtered(partial_pos)) {
continue;
}
nr_good_hits++;
Expand Down
2 changes: 1 addition & 1 deletion src/randstrobes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct RefRandstrobe {
packed_t m_packed; // packed representation of ref_index and strobe offset

public:
static constexpr uint32_t max_number_of_references = (1 << (32 - bit_alloc)) - 1;
static constexpr uint32_t max_number_of_references = (1 << (32 - bit_alloc - 1)) - 1; // bit_alloc - 1 because 1 bit to main_is_first()
};

struct QueryRandstrobe {
Expand Down

0 comments on commit eee0cd8

Please sign in to comment.