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

◆ half_duplex_blend_sqrt_q15()

uint8_t anonymous_namespace{wave_simulation.cpp}::half_duplex_blend_sqrt_q15 ( uint16_t x)

Definition at line 11 of file wave_simulation.cpp.

11 {
12 x = MIN(x, 32767); // Q15
13 const int Q = 15;
14 uint32_t X = (uint32_t)x << Q; // promote to Q30
15 uint32_t 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<int16_t>(y) >> 8;
22}
uint32_t x[NUM_LAYERS]
Definition Fire2023.ino:80
uint32_t y[NUM_LAYERS]
Definition Fire2023.ino:81
#define MIN(a, b)
Definition math_macros.h:8

References MIN, x, and y.