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

◆ roundedDivideQ16()

i64 fl::anonymous_namespace{device_solve.cpp.hpp}::roundedDivideQ16 ( i64 numerator,
i64 denominator )

Nearest integer of numerator / denominator, halves away from zero.

Truncating would bias every column toward zero and the bias does not cancel: the inverse is built from products of these.

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

137 {
138 if (denominator < 0) {
139 numerator = -numerator;
140 denominator = -denominator;
141 }
142 const i64 half = denominator / 2;
143 if (numerator >= 0) {
144 return (numerator + half) / denominator;
145 }
146 return -((-numerator + half) / denominator);
147}
fl::i64 i64
Definition stdint.h:221

References fl::FL_NO_EXCEPT, and roundedDivideQ16().

Referenced by emitterColumnQ16(), and roundedDivideQ16().

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