MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / dsUpperBound

Function dsUpperBound

app/src/DSP.h:876–893  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

874 */
875template<typename XAt>
876[[nodiscard]] inline std::size_t dsUpperBound(std::size_t n, XAt xAt, const ssfp_t bound)
877{
878 std::size_t lo = 0;
879 std::size_t len = n;
880 for (int step = 0; step < 64 && len > 0; ++step) {
881 const std::size_t half = len / 2;
882 const std::size_t mid = lo + half;
883 if (xAt(mid) <= bound) {
884 lo = mid + 1;
885 len = len - half - 1;
886 }
887
888 else
889 len = half;
890 }
891
892 return lo;
893}
894
895/**
896 * @brief Finds the first and last indices whose (X, Y) pair is fully finite. Returns

Callers 2

downsampleTimeWindowFunction · 0.85
downsampleWindowAbsoluteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected