FastLED 3.10.8
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 118 of file s16x16x4.h.

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

References FASTLED_FORCE_INLINE, and raw.

Referenced by cos(), and sin().

+ Here is the caller graph for this function: