Skip to content

Commit

Permalink
Switch from min to max in RandstrobeIterator/-Generator
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelm committed Sep 29, 2023
1 parent a290e7b commit 69205c6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/randstrobes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ Randstrobe RandstrobeIterator::get(unsigned int strobe1_index) const {
auto strobe1 = syncmers[strobe1_index];
auto max_position = strobe1.position + max_dist;
unsigned int w_start = strobe1_index + w_min;
uint64_t min_val = std::numeric_limits<uint64_t>::max();
uint64_t max_val = std::numeric_limits<uint64_t>::min();
Syncmer strobe2 = strobe1;

for (auto i = w_start; i <= w_end && syncmers[i].position <= max_position; i++) {
Expand All @@ -161,8 +161,8 @@ Randstrobe RandstrobeIterator::get(unsigned int strobe1_index) const {
std::bitset<64> b = (strobe1.hash ^ syncmers[i].hash) & q;
uint64_t res = b.count();

if (res < min_val) {
min_val = res;
if (res > max_val) {
max_val = res;
strobe2 = syncmers[i];
}
}
Expand All @@ -183,7 +183,7 @@ Randstrobe RandstrobeGenerator::next() {
}
auto strobe1 = syncmers[0];
auto max_position = strobe1.position + max_dist;
uint64_t min_val = std::numeric_limits<uint64_t>::max();
uint64_t max_val = std::numeric_limits<uint64_t>::min();
Syncmer strobe2 = strobe1; // Default if no nearby syncmer

for (auto i = w_min; i < syncmers.size() && syncmers[i].position <= max_position; i++) {
Expand All @@ -192,8 +192,8 @@ Randstrobe RandstrobeGenerator::next() {
std::bitset<64> b = (strobe1.hash ^ syncmers[i].hash) & q;
uint64_t res = b.count();

if (res < min_val) {
min_val = res;
if (res > max_val) {
max_val = res;
strobe2 = syncmers[i];
}
}
Expand Down

0 comments on commit 69205c6

Please sign in to comment.