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

◆ pow()

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

Definition at line 235 of file s16x16.h.

235 {
236 if (base.mValue <= 0) return s16x16();
237 constexpr s16x16 one(1.0f);
238 if (exp.mValue == 0) return one;
239 if (base == one) return one;
240 // Snap base values within ~2 ULPs of 1.0 to exactly 1.0 to dodge the
241 // log2(1+t) minimax polynomial's upper-endpoint residual (#2969).
242 constexpr i32 kOneRaw = static_cast<i32>(SCALE);
243 if (base.mValue >= (kOneRaw - 2) && base.mValue <= kOneRaw) {
244 return one;
245 }
246 return exp2_fp(exp * log2_fp(base));
247 }
static FASTLED_FORCE_INLINE s16x16 log2_fp(s16x16 x) FL_NOEXCEPT
Definition s16x16.h:340
static constexpr i32 SCALE
Definition s16x16.h:23
constexpr s16x16() FL_NOEXCEPT=default
static FASTLED_FORCE_INLINE s16x16 exp2_fp(s16x16 x) FL_NOEXCEPT
Definition s16x16.h:375
enable_if< is_fixed_point< T >::value, T >::type exp(T x) FL_NOEXCEPT

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

Referenced by fl::applyGamma_video(), and fl::FlowFieldFP::flowAdvect().

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