You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(wave): precompute damping as a Q15 multiplier (refs #3073 §6, alt to §2) #3096
f = static_cast<i32>(
(static_cast<i64>(f) * mDampDecayQ15) >> 15);
Why
This is equivalent to §2 (#TBD — arithmetic shift) for power-of-two damp, but generalizes cleanly if the public API is ever extended to non-power-of-two damping (e.g. setDampening(float) instead of setDampening(int)).
Cortex-M4+ lowers this to a single smmlsr/smulwb. AVR does it as a 16×32 multiply (~30 cycles) — same ballpark as §2's shift but cleaner semantics.
When to pick §6 vs §2
Pick §2 (#TBD) if you want the minimum-diff fix and don't care about non-power-of-two damping.
Pick §6 if you want the abstraction to last beyond the current int dampening API surface.
If §2 ships first, this becomes a small refactor that drops the "damping is a power of 2" implicit assumption from setDampening.
Acceptance
bash test fl_math_wave_wave_simulation_real --cpp passes.
Setter accepts float damping and rounds to the nearest 1-LSB Q15 representation; getter round-trips within ±1 LSB.
Activity
zackees commentedon Jun 15, 2026
Parent meta: #3098. Alternative to #3092 (§2 arithmetic shift) — pick this if you want non-power-of-two damping support.
perf(wave): precompute damping decay as a Q15 multiplier (#3105)