68template <
int IntBits,
int FracBits, Sign S>
90template <
int IntBits,
int FracBits, Sign S = Sign::SIGNED>
101template <
typename From,
typename To>
103 static constexpr bool value =
false;
106template <
int FromInt,
int FromFrac, Sign FromSign,
int ToInt,
int ToFrac, Sign ToSign>
109 (FromInt <= ToInt) &&
110 (FromFrac <= ToFrac) &&
111 (FromSign == ToSign) &&
112 (FromInt != ToInt || FromFrac != ToFrac);
128template <
int IntBits,
int FracBits, Sign S>
131 using Base =
typename fixed_point_impl<IntBits, FracBits, S>::type;
138 template <
int OtherFrac,
typename OtherRawType>
141 static_cast<PromotionType>(other_raw) << (FracBits - OtherFrac));
149 using Base::INT_BITS;
150 using Base::FRAC_BITS;
169 template <
typename IntT, detail::enable_if_
integer_t<IntT> = 0>
181 template <
int OtherInt,
int OtherFrac, Sign OtherSign>
283 return Base::operator<(b);
287 return Base::operator>(b);
291 return Base::operator<=(b);
295 return Base::operator>=(b);
299 return Base::operator==(b);
303 return Base::operator!=(b);
364 return from_raw(Base::smoothstep(edge0, edge1,
x).
raw());
398 Base base_sin, base_cos;
399 Base::sincos(angle, base_sin, base_cos);
449template <
int IntBits,
int FracBits>
452template <
int IntBits,
int FracBits>
456template <
int IntBits,
int FracBits>
459template <
int IntBits,
int FracBits>
473template <
int I,
int F, Sign S>
507inline constexpr typename enable_if<is_fixed_point<T>::value, T>::type
512inline constexpr typename enable_if<is_fixed_point<T>::value, T>::type
517inline constexpr typename enable_if<is_fixed_point<T>::value, T>::type
524inline constexpr typename enable_if<is_fixed_point<T>::value, T>::type
529inline constexpr typename enable_if<is_fixed_point<T>::value,
int>::type
536inline constexpr typename enable_if<is_fixed_point<T>::value, T>::type
541inline constexpr typename enable_if<is_fixed_point<T>::value, T>::type
546inline constexpr typename enable_if<is_fixed_point<T>::value, T>::type
551inline typename enable_if<is_fixed_point<T>::value, T>::type
558inline constexpr typename enable_if<is_fixed_point<T>::value, T>::type
563inline constexpr typename enable_if<is_fixed_point<T>::value, T>::type
568inline typename enable_if<is_fixed_point<T>::value, T>::type
576inline typename enable_if<is_fixed_point<T>::value, T>::type
581inline typename enable_if<is_fixed_point<T>::value, T>::type
588inline typename enable_if<is_fixed_point<T>::value,
void>::type
593inline typename enable_if<is_fixed_point<T>::value, T>::type
598inline typename enable_if<is_fixed_point<T>::value, T>::type
603inline typename enable_if<is_fixed_point<T>::value, T>::type
608inline typename enable_if<is_fixed_point<T>::value, T>::type
619inline typename enable_if<is_fixed_point<T>::value, T>::type
621 return T::pow(base,
exp);
632inline typename enable_if<is_fixed_point<T>::value, T>::type
634 static const T e_val(
static_cast<float>(
FL_E));
641inline typename enable_if<is_fixed_point<T>::value, T>::type
655 (
static_cast<i64>(
mValue) * b.raw()) >> 31));
static FASTLED_FORCE_INLINE fixed_point cos(fixed_point angle) FL_NOEXCEPT
static FASTLED_FORCE_INLINE fixed_point asin(fixed_point x) FL_NOEXCEPT
FASTLED_FORCE_INLINE constexpr fixed_point() FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE fixed_point floor(fixed_point x) FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE bool operator>(fixed_point b) const FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE fixed_point rsqrt(fixed_point x) FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE fixed_point mod(fixed_point a, fixed_point b) FL_NOEXCEPT
constexpr fixed_point(const fixed_point< OtherInt, OtherFrac, OtherSign > &other, typename enable_if< is_fp_promotable< fixed_point< OtherInt, OtherFrac, OtherSign >, fixed_point< IntBits, FracBits, S > >::value, int >::type=0) FL_NOEXCEPT
static FASTLED_FORCE_INLINE fixed_point atan2(fixed_point y, fixed_point x) FL_NOEXCEPT
constexpr fixed_point(RawType raw, typename Base::RawTag tag) FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE float to_float() const FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE fixed_point max(fixed_point a, fixed_point b) FL_NOEXCEPT
static constexpr RawType promote_fp(OtherRawType other_raw) FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE fixed_point lerp(fixed_point a, fixed_point b, fixed_point t) FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE fixed_point clamp(fixed_point x, fixed_point lo, fixed_point hi) FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE fixed_point abs(fixed_point x) FL_NOEXCEPT
static FASTLED_FORCE_INLINE fixed_point atan(fixed_point x) FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE fixed_point operator*(i32 scalar) const FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE fixed_point operator-() const FL_NOEXCEPT
static FASTLED_FORCE_INLINE fixed_point sin(fixed_point angle) FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE fixed_point operator+(fixed_point b) const FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE fixed_point from_raw(RawType raw) FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE fixed_point min(fixed_point a, fixed_point b) FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE fixed_point operator>>(int shift) const FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE fixed_point operator<<(int shift) const FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE bool operator==(fixed_point b) const FL_NOEXCEPT
FASTLED_FORCE_INLINE constexpr fixed_point(IntT n) FL_NOEXCEPT
FASTLED_FORCE_INLINE constexpr fixed_point(float f) FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE fixed_point ceil(fixed_point x) FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE bool operator>=(fixed_point b) const FL_NOEXCEPT
decltype(Base().raw()) RawType
FASTLED_FORCE_INLINE constexpr RawType raw() const FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE fixed_point operator/(fixed_point b) const FL_NOEXCEPT
static FASTLED_FORCE_INLINE fixed_point acos(fixed_point x) FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE bool operator!=(fixed_point b) const FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE fixed_point sign(fixed_point x) FL_NOEXCEPT
typename fixed_point_impl< IntBits, FracBits, S >::type Base
static FASTLED_FORCE_INLINE fixed_point smoothstep(fixed_point edge0, fixed_point edge1, fixed_point x) FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE fixed_point operator*(fixed_point b) const FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE fixed_point step(fixed_point edge, fixed_point x) FL_NOEXCEPT
static FASTLED_FORCE_INLINE void sincos(fixed_point angle, fixed_point &out_sin, fixed_point &out_cos) FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE fixed_point operator-(fixed_point b) const FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE bool operator<(fixed_point b) const FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE bool operator<=(fixed_point b) const FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE fixed_point fract(fixed_point x) FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE i32 to_int() const FL_NOEXCEPT
friend constexpr fixed_point operator*(i32 scalar, fixed_point fp) FL_NOEXCEPT
static FASTLED_FORCE_INLINE fixed_point pow(fixed_point base, fixed_point exp) FL_NOEXCEPT
typename conditional<(S==Sign::SIGNED), i64, u64 >::type PromotionType
static constexpr FASTLED_FORCE_INLINE fixed_point sqrt(fixed_point x) FL_NOEXCEPT
constexpr s0x32() FL_NOEXCEPT=default
constexpr FASTLED_FORCE_INLINE s0x32 operator*(s0x32 b) const FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE s16x16 from_raw(i32 raw) FL_NOEXCEPT
constexpr int type_rank< T >::value
enable_if< is_fixed_point< T >::value, T >::type atan2(T y, T x) FL_NOEXCEPT
constexpr enable_if< is_fixed_point< T >::value, T >::type ceil(T x) FL_NOEXCEPT
enable_if< is_fixed_point< T >::value, T >::type smoothstep(T edge0, T edge1, T x) FL_NOEXCEPT
enable_if< is_fixed_point< T >::value, void >::type sincos(T angle, T &out_sin, T &out_cos) FL_NOEXCEPT
constexpr enable_if< is_fixed_point< T >::value, T >::type sqrt(T x) FL_NOEXCEPT
FASTLED_FORCE_INLINE CRGB operator*(const CRGB &p1, u8 d) FL_NOEXCEPT
Multiply each of the channels by a constant, saturating each channel at 0xFF.
constexpr enable_if< is_fixed_point< T >::value, T >::type floor(T x) FL_NOEXCEPT
constexpr enable_if< is_fixed_point< T >::value, T >::type fract(T x) FL_NOEXCEPT
constexpr enable_if< is_fixed_point< T >::value, int >::type sign(T x) FL_NOEXCEPT
enable_if< is_fixed_point< T >::value, T >::type acos(T x) FL_NOEXCEPT
enable_if< is_fixed_point< T >::value, T >::type powfp(T base, T exp) FL_NOEXCEPT
enable_if< is_fixed_point< T >::value, T >::type expfp(T x) FL_NOEXCEPT
enable_if< is_fixed_point< T >::value, T >::type pow(T base, T exp) FL_NOEXCEPT
fixed_point< IntBits, FracBits, Sign::UNSIGNED > ufixed_integer
sfixed_integer< IntBits, FracBits > sfixed_point
enable_if< is_fixed_point< T >::value, T >::type cos(T angle) FL_NOEXCEPT
constexpr enable_if< is_fixed_point< T >::value, T >::type step(T edge, T x) FL_NOEXCEPT
enable_if< is_fixed_point< T >::value, T >::type sin(T angle) FL_NOEXCEPT
constexpr enable_if< is_fixed_point< T >::value, T >::type rsqrt(T x) FL_NOEXCEPT
enable_if< is_fixed_point< T >::value, T >::type asin(T x) FL_NOEXCEPT
enable_if< is_fixed_point< T >::value, T >::type exp(T x) FL_NOEXCEPT
integral_constant< bool, true > true_type
constexpr enable_if< is_fixed_point< T >::value, T >::type abs(T x) FL_NOEXCEPT
ufixed_integer< IntBits, FracBits > ufixed_point
fixed_point< IntBits, FracBits, Sign::SIGNED > sfixed_integer
enable_if< is_fixed_point< T >::value, T >::type atan(T x) FL_NOEXCEPT
constexpr enable_if< is_fixed_point< T >::value, T >::type mod(T a, T b) FL_NOEXCEPT
constexpr enable_if< is_fixed_point< T >::value, T >::type clamp(T x, T lo, T hi) FL_NOEXCEPT
FASTLED_FORCE_INLINE float lerp(float t, float a, float b)
Base definition for an LED controller.
#define FASTLED_FORCE_INLINE