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

◆ dotSolveRowQ16()

i32 fl::anonymous_namespace{device_solve.cpp.hpp}::dotSolveRowQ16 ( const i32(&) row[3],
const i32(&) v[3] )

Definition at line 189 of file device_solve.cpp.hpp.

189 {
190 const i64 acc = static_cast<i64>(row[0]) * static_cast<i64>(v[0])
191 + static_cast<i64>(row[1]) * static_cast<i64>(v[1])
192 + static_cast<i64>(row[2]) * static_cast<i64>(v[2]);
193 const i64 rounded = acc >= 0 ? (acc + 32768) >> 16
194 : -((-acc + 32768) >> 16);
195 // Saturate rather than wrap. An extreme target can still land outside
196 // s16.16 after the shift, and wrapping would turn an out-of-gamut
197 // overshoot into a wildly wrong colour of the opposite sign, which the
198 // gamut mapper downstream would then treat as legitimate.
199 constexpr i64 kMax = 2147483647;
200 constexpr i64 kMin = -2147483647 - 1;
201 if (rounded > kMax) {
202 return static_cast<i32>(kMax);
203 }
204 if (rounded < kMin) {
205 return static_cast<i32>(kMin);
206 }
207 return static_cast<i32>(rounded);
208}
fl::i64 i64
Definition stdint.h:221

References dotSolveRowQ16(), and fl::FL_NO_EXCEPT.

Referenced by dotSolveRowQ16().

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