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

◆ half_duplex_blend_sqrt_q15()

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

Definition at line 12 of file wave_simulation.cpp.

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

References MIN, x, and y.