diff --git a/src/randstrobes.cpp b/src/randstrobes.cpp index 3cfb5a0a..ba33e98a 100644 --- a/src/randstrobes.cpp +++ b/src/randstrobes.cpp @@ -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::max(); + uint64_t max_val = std::numeric_limits::min(); Syncmer strobe2 = strobe1; for (auto i = w_start; i <= w_end && syncmers[i].position <= max_position; i++) { @@ -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]; } } @@ -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::max(); + uint64_t max_val = std::numeric_limits::min(); Syncmer strobe2 = strobe1; // Default if no nearby syncmer for (auto i = w_min; i < syncmers.size() && syncmers[i].position <= max_position; i++) { @@ -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]; } }