33 template <
typename IntT, detail::enable_if_
integer_t<IntT> = 0>
38 template <
typename OtherFP>
39 constexpr u24x8(
const OtherFP& other,
112 return from_raw(a.mValue % b.mValue);
134 return a.mValue < b.mValue ? a : b;
138 return a.mValue > b.mValue ? a : b;
142 return a + (b - a) *
t;
146 return x < lo ? lo : (
x > hi ? hi :
x);
154 constexpr u24x8 zero(0.0f);
155 constexpr u24x8 one(1.0f);
156 constexpr u24x8 two(2.0f);
157 constexpr u24x8 three(3.0f);
158 u24x8 t =
clamp((
x - edge0) / (edge1 - edge0), zero, one);
159 return t *
t * (three - two *
t);
174 if (base.mValue == 0)
return u24x8();
175 constexpr u24x8 one(1.0f);
176 if (
exp.mValue == 0)
return one;
177 if (base == one)
return one;
180 constexpr u32 kOneRaw =
static_cast<u32
>(
SCALE);
181 if (base.mValue >= (kOneRaw - 2u) && base.mValue <= kOneRaw) {
200 : (v & 0x00000002u) ? r + 1
211 if (msb < 0)
return u24x8();
223 constexpr int IFRAC = 16;
224 constexpr u64 c0 = 94528ULL;
225 constexpr u64 c1 = 19727ULL;
231 u64 acc = c0 + ((c1 * t16) >> IFRAC);
232 u64 frac_part = (acc * t16) >> IFRAC;
235 u32 frac8 =
static_cast<u32
>(frac_part >> (IFRAC -
FRAC_BITS));
248 int_pow =
static_cast<u32
>(
SCALE) << n;
251 constexpr int IFRAC = 16;
252 constexpr u64 d0 = 45427ULL;
253 constexpr u64 d1 = 15775ULL;
254 constexpr u64 d2 = 3497ULL;
255 constexpr u64 d3 = 836ULL;
260 acc = d2 + ((acc * fr16) >> IFRAC);
261 acc = d1 + ((acc * fr16) >> IFRAC);
262 acc = d0 + ((acc * fr16) >> IFRAC);
263 constexpr u64 one16 = 1ULL << IFRAC;
264 u64 frac_pow16 = one16 + ((acc * fr16) >> IFRAC);
266 u32 frac_pow8 =
static_cast<u32
>(frac_pow16 >> (IFRAC -
FRAC_BITS));
constexpr FASTLED_FORCE_INLINE u24x8 operator<<(int shift) const FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE u24x8 rsqrt(u24x8 x) FL_NOEXCEPT
static FASTLED_FORCE_INLINE u24x8 pow(u24x8 base, u24x8 exp) FL_NOEXCEPT
static constexpr int INT_BITS
friend constexpr u24x8 operator*(u32 scalar, u24x8 fp) FL_NOEXCEPT
constexpr bool operator>=(u24x8 b) const FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE u24x8 operator/(u24x8 b) const FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE u24x8 mod(u24x8 a, u24x8 b) FL_NOEXCEPT
static FASTLED_FORCE_INLINE u24x8 smoothstep(u24x8 edge0, u24x8 edge1, u24x8 x) FL_NOEXCEPT
constexpr u32 raw() const FL_NOEXCEPT
constexpr bool operator>(u24x8 b) const FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE u24x8 max(u24x8 a, u24x8 b) FL_NOEXCEPT
constexpr bool operator==(u24x8 b) const FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE u24x8 operator*(u24x8 b) const FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE u24x8 abs(u24x8 x) FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE u24x8 from_raw(u32 raw) FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE u24x8 fract(u24x8 x) FL_NOEXCEPT
constexpr u24x8() FL_NOEXCEPT=default
static FASTLED_FORCE_INLINE u24x8 exp2_fp(u24x8 x) FL_NOEXCEPT
constexpr bool operator<=(u24x8 b) const FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE u24x8 floor(u24x8 x) FL_NOEXCEPT
constexpr u24x8(u32 raw, RawTag) FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE u24x8 clamp(u24x8 x, u24x8 lo, u24x8 hi) FL_NOEXCEPT
static constexpr int _highest_bit_step(u32 v, int r) FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE u24x8 lerp(u24x8 a, u24x8 b, u24x8 t) FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE u24x8 operator-(u24x8 b) const FL_NOEXCEPT
static FASTLED_FORCE_INLINE u24x8 log2_fp(u24x8 x) FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE u24x8 operator*(u32 scalar) const FL_NOEXCEPT
constexpr float to_float() const FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE u24x8 sqrt(u24x8 x) FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE u24x8 step(u24x8 edge, u24x8 x) FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE u24x8 ceil(u24x8 x) FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE int highest_bit(u32 v) FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE u24x8 min(u24x8 a, u24x8 b) FL_NOEXCEPT
constexpr u24x8(const OtherFP &other, typename fl::enable_if<(OtherFP::INT_BITS<=INT_BITS) &&(OtherFP::FRAC_BITS<=FRAC_BITS) &&(OtherFP::INT_BITS !=INT_BITS||OtherFP::FRAC_BITS !=FRAC_BITS), int >::type=0) FL_NOEXCEPT
constexpr bool operator<(u24x8 b) const FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE u24x8 operator+(u24x8 b) const FL_NOEXCEPT
constexpr u24x8(IntT n) FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE u24x8 operator>>(int shift) const FL_NOEXCEPT
constexpr u32 to_int() const FL_NOEXCEPT
static constexpr i32 SCALE
constexpr bool operator!=(u24x8 b) const FL_NOEXCEPT
static constexpr int FRAC_BITS
#define constexpr
Declares that it is possible to evaluate a value at compile time, introduced in C++11.
expected< T, E > result
Alias for expected (Rust-style naming)
enable_if< is_fixed_point< T >::value, T >::type exp(T x) FL_NOEXCEPT
FL_OPTIMIZE_FUNCTION constexpr u32 isqrt64(u64 x) FL_NOEXCEPT
Base definition for an LED controller.
#define FL_OPTIMIZATION_LEVEL_O3_BEGIN
#define FASTLED_FORCE_INLINE
#define FL_OPTIMIZATION_LEVEL_O3_END