diff --git a/src/sfizz/MathHelpers.h b/src/sfizz/MathHelpers.h index f0dbebc4..d5b0cd3a 100644 --- a/src/sfizz/MathHelpers.h +++ b/src/sfizz/MathHelpers.h @@ -139,6 +139,20 @@ constexpr T clamp(T v, T lo, T hi) return max(min(v, hi), lo); } +/** + * @brief Compute the floating-point remainder (fmod) + * + * @tparam T + * @param x + * @param m + * @return T + */ +template +inline constexpr T fastFmod(T x, T m) +{ + return x - m * static_cast(x / m); +} + template inline CXX14_CONSTEXPR void incrementAll(T& only) {