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

◆ sincos()

FASTLED_FORCE_INLINE void fl::s16x16x4::sincos ( s16x16x4 & out_sin,
s16x16x4 & out_cos ) const
inline

Compute sin and cos of 4 angles (in radians) Results written to out_sin and out_cos.

Definition at line 114 of file s16x16x4.h.

114 {
115 // Convert radians to 24-bit angle units (same as scalar s16x16)
116 // RAD_TO_24 = 2^24 / (2π) in Q16
117 static constexpr i32 RAD_TO_24 = 2670177; // from s16x16.h
118
119 // Convert 4 angles: mulhi_i32_4 does (i64*i64) >> 16
120 auto angles_u32 = simd::mulhi_su32_4(raw, simd::set1_u32_4(static_cast<u32>(RAD_TO_24)));
121
122 // Call vectorized sincos
123 auto sc = sincos32_simd(angles_u32);
124
125 // Shift results right by 15 to convert from raw sin32 output to Q16.16
126 out_sin = from_raw(simd::sra_i32_4(sc.sin_vals, 15));
127 out_cos = from_raw(simd::sra_i32_4(sc.cos_vals, 15));
128 }
FASTLED_FORCE_INLINE SinCos32_simd sincos32_simd(simd::simd_u32x4 angles) FL_NOEXCEPT
Process 4 angles simultaneously, returning vectorized sin/cos values SIMD-optimized: vectorized angle...
Definition sin32.h:145
static FASTLED_FORCE_INLINE s16x16x4 from_raw(simd::simd_u32x4 r)
Definition s16x16x4.h:24
simd::simd_u32x4 raw
Definition s16x16x4.h:20

References FASTLED_FORCE_INLINE.