FastLED 3.9.15
Loading...
Searching...
No Matches

◆ half_duplex_blend_sqrt_q15()

fl::u8 anonymous_namespace{wave_simulation.cpp.hpp}::half_duplex_blend_sqrt_q15 ( fl::u16 x)

Definition at line 11 of file wave_simulation.cpp.hpp.

11 {
12 x = fl::min(x, 32767); // Q15
13 const int Q = 15;
14 fl::u32 X = (fl::u32)x << Q; // promote to Q30
15 fl::u32 y = (1u << Q); // start at β€œ1.0” in Q15
16
17 // 3–4 iterations is plenty for 15‑bit precision:
18 for (int i = 0; i < 4; i++) {
19 y = (y + (X / y)) >> 1;
20 }
21 return static_cast<fl::i16>(y) >> 8;
22}
int y
Definition simple.h:93
int x
Definition simple.h:92
FL_DISABLE_WARNING_PUSH U constexpr common_type_t< T, U > min(T a, U b) FL_NOEXCEPT
Definition math.h:71

References fl::min(), x, and y.

+ Here is the call graph for this function: