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

◆ pow()

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

Definition at line 216 of file s8x24.h.

216 {
217 if (base.mValue <= 0) return s8x24();
218 constexpr s8x24 one(1.0f);
219 if (exp.mValue == 0) return one;
220 if (base == one) return one;
221 // Snap base values within ~2 ULPs of 1.0 to exactly 1.0 to dodge the
222 // log2(1+t) minimax polynomial's upper-endpoint residual (#2969).
223 constexpr i32 kOneRaw = static_cast<i32>(SCALE);
224 if (base.mValue >= (kOneRaw - 2) && base.mValue <= kOneRaw) {
225 return one;
226 }
227 return exp2_fp(exp * log2_fp(base));
228 }
static constexpr i32 SCALE
Definition s8x24.h:23
constexpr s8x24() FL_NOEXCEPT=default
static FASTLED_FORCE_INLINE s8x24 exp2_fp(s8x24 x) FL_NOEXCEPT
Definition s8x24.h:353
static FASTLED_FORCE_INLINE s8x24 log2_fp(s8x24 x) FL_NOEXCEPT
Definition s8x24.h:319
enable_if< is_fixed_point< T >::value, T >::type exp(T x) FL_NOEXCEPT

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

Referenced by fl::Gamma8Impl::Gamma8Impl().

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