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

◆ pow()

static FASTLED_FORCE_INLINE u12x4 fl::u12x4::pow ( u12x4 base,
u12x4 exp )
inlinestatic

Definition at line 186 of file u12x4.h.

186 {
187 if (base.mValue == 0) return u12x4();
188 constexpr u12x4 one(1.0f);
189 if (exp.mValue == 0) return one;
190 if (base == one) return one;
191 // Snap base values within ~2 ULPs of 1.0 to exactly 1.0 to dodge the
192 // log2(1+t) minimax polynomial's upper-endpoint residual (#2969).
193 constexpr u16 kOneRaw = static_cast<u16>(SCALE);
194 if (base.mValue >= static_cast<u16>(kOneRaw - 2) &&
195 base.mValue <= kOneRaw) {
196 return one;
197 }
198 return exp2_fp(exp * log2_fp(base));
199 }
constexpr u12x4() FL_NOEXCEPT=default
static constexpr i32 SCALE
Definition u12x4.h:22
static FASTLED_FORCE_INLINE u12x4 log2_fp(u12x4 x) FL_NOEXCEPT
Definition u12x4.h:222
static FASTLED_FORCE_INLINE u12x4 exp2_fp(u12x4 x) FL_NOEXCEPT
Definition u12x4.h:257
enable_if< is_fixed_point< T >::value, T >::type exp(T x) FL_NOEXCEPT

References u12x4(), fl::exp(), exp2_fp(), FASTLED_FORCE_INLINE, FL_NOEXCEPT, log2_fp(), and SCALE.

+ Here is the call graph for this function: