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

◆ log2_horner() [1/2]

template<typename Derived, int IntBits, int FracBits>
template<typename PolyType>
static FASTLED_FORCE_INLINE Derived fl::fixed_point_base< Derived, IntBits, FracBits >::log2_horner ( raw_type int_part,
PolyType t_ifrac,
PolyType c0,
PolyType c1,
PolyType c2,
PolyType c3,
fl::false_type  )
inlinestaticprivate

Definition at line 392 of file base.h.

394 {
395 constexpr int IFRAC = traits::IFRAC;
396 PolyType acc = c3;
397 acc = c2 + ((acc * t_ifrac) >> IFRAC);
398 acc = c1 + ((acc * t_ifrac) >> IFRAC);
399 acc = c0 + ((acc * t_ifrac) >> IFRAC);
401 raw_type frac_result = static_cast<raw_type>(frac_part >> (IFRAC - FRAC_BITS));
402 return Derived::from_raw(static_cast<raw_type>(static_cast<unsigned_raw_type>(int_part) << FRAC_BITS) + frac_result);
403 }
typename traits::unsigned_raw_type unsigned_raw_type
Definition base.h:32
static constexpr int FRAC_BITS
Definition base.h:38
typename traits::raw_type raw_type
Definition base.h:31
static constexpr int IFRAC
Definition traits.h:120

References FASTLED_FORCE_INLINE, FRAC_BITS, and fl::fixed_point_traits< IntBits, FracBits >::IFRAC.