From 059831534c7e884f0a607ed86b582fd00d821731 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Sat, 26 Sep 2026 23:24:03 +0200 Subject: New upstream version 3.2.0~rc1+dfsg --- widgets/BandHopping.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 widgets/BandHopping.cpp (limited to 'widgets/BandHopping.cpp') diff --git a/widgets/BandHopping.cpp b/widgets/BandHopping.cpp new file mode 100644 index 00000000..867511d7 --- /dev/null +++ b/widgets/BandHopping.cpp @@ -0,0 +1,18 @@ +#include "widgets/BandHopping.hpp" + +int next_band_hop_index (std::vector const& selected, int start_index) +{ + auto const entry_count = static_cast (selected.size ()); + if (0 == entry_count) return -1; + + auto normalized_start = start_index % entry_count; + if (normalized_start < 0) normalized_start += entry_count; + + for (int offset = 0; offset < entry_count; ++offset) + { + auto const index = (normalized_start + offset) % entry_count; + if (selected[index]) return index; + } + + return -1; +} -- cgit v1.2.3