FastLED 3.10.6
Loading...
Searching...
No Matches

◆ sourceChromaticityQ16()

bool fl::anonymous_namespace{source_xyz.cpp.hpp}::sourceChromaticityQ16 ( Chromaticity c,
i32(&) out[2] )

A chromaticity, converted from float by its bits, that is real and usable: inside the open unit square with a non-zero y.

The float check it replaces (NaN, 0 < x < 1, 1e-6 < y < 1) is kept, with y's floor at one s16.16 step – a smaller y would quantise to zero and be divided by.

Definition at line 17 of file source_xyz.cpp.hpp.

17 {
18 if (!q16FromFloatBits(c.x, &out[0]) || !q16FromFloatBits(c.y, &out[1])) {
19 return false;
20 }
21 return out[0] > 0 && out[0] < kSourceQ16One && out[1] > 0 &&
22 out[1] < kSourceQ16One;
23}
bool q16FromFloatBits(float value, i32 *out) FL_NO_EXCEPT
s16.16 of a float, rounded to nearest, computed from its IEEE-754 bits with integer arithmetic only –...

References fl::FL_NO_EXCEPT, kSourceQ16One, fl::q16FromFloatBits(), sourceChromaticityQ16(), fl::Chromaticity::x, and fl::Chromaticity::y.

Referenced by sourceChromaticityQ16().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: