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

◆ log2_horner() [2/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::true_type  )
inlinestaticprivate

Definition at line 377 of file base.h.

379 {
380 constexpr int IFRAC = traits::IFRAC;
381 PolyType acc = c3;
382 acc = c2 + static_cast<PolyType>((static_cast<i64>(acc) * t_ifrac) >> IFRAC);
383 acc = c1 + static_cast<PolyType>((static_cast<i64>(acc) * t_ifrac) >> IFRAC);
384 acc = c0 + static_cast<PolyType>((static_cast<i64>(acc) * t_ifrac) >> IFRAC);
385 PolyType frac_part = static_cast<PolyType>((static_cast<i64>(acc) * t_ifrac) >> IFRAC);
386 raw_type frac_result = static_cast<raw_type>(frac_part >> (IFRAC - FRAC_BITS));
387 return Derived::from_raw(static_cast<raw_type>(static_cast<unsigned_raw_type>(int_part) << FRAC_BITS) + frac_result);
388 }
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.

Referenced by log2_fp().

+ Here is the caller graph for this function: