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

◆ anonymous enum

anonymous enum : bool
Enumerator
value 

Definition at line 354 of file s16x16x4.h.

365{
366
367// Forward declaration for cross-type operations
368struct s0x32x4;
369
372struct s16x16x4 {
373 simd::simd_u32x4 raw; // 4× i32 values in Q16 format
374
375 // ---- Construction ------------------------------------------------------
376
379 result.raw = r;
380 return result;
381 }
382
383 // Load 4 s16x16 values from memory (unaligned access supported)
385 return from_raw(simd::platforms::load_u32_4(reinterpret_cast<const u32*>(ptr))); // ok reinterpret cast
386 }
387
388 // Store 4 s16x16 values to memory (unaligned access supported)
389 FASTLED_FORCE_INLINE void store(s16x16* ptr) const {
390 simd::platforms::store_u32_4(reinterpret_cast<u32*>(ptr), raw); // ok reinterpret cast
391 }
392
393 // Broadcast single s16x16 value to all 4 lanes
395 return from_raw(simd::platforms::set1_u32_4(static_cast<u32>(value.raw())));
396 }
397
398 // ---- SIMD arithmetic (s16x16x4 OP s16x16x4 → s16x16x4) -----------------
399
401 return from_raw(simd::add_i32_4(raw, b.raw));
402 }
403
405 return from_raw(simd::sub_i32_4(raw, b.raw));
406 }
407
409 // Q16 × Q16 = Q32 → shift right 16 → Q16
410 return from_raw(simd::mulhi_i32_4(raw, b.raw));
411 }
412
414 // Unary negation: -x = 0 - x
415 auto zero = simd::set1_u32_4(0);
417 }
418
421 }
422
425 }
426
427 // Cross-type multiply: s16x16x4 × s0x32x4 → s16x16x4 (commutative)
428 // Implemented after s0x32x4 is defined
430
431 // ---- Math functions -------------------------------------------------------
432
435 // mask = -1 if negative (sign extended), 0 if positive
436 auto mask = simd::sra_i32_4(raw, 31);
437 // flip bits if negative, then add 1 (two's complement)
440 }
441
444 return from_raw(simd::min_i32_4(raw, b.raw));
445 }
446
449 return from_raw(simd::max_i32_4(raw, b.raw));
450 }
451
454 return max(lo).min(hi);
455 }
456
460 auto t_vec = s16x16x4::set1(t);
461 auto diff = b - (*this);
462 return (*this) + (diff * t_vec);
463 }
464
468 // Convert radians to 24-bit angle units (same as scalar s16x16)
469 // RAD_TO_24 = 2^24 / (2π) in Q16
470 static constexpr i32 RAD_TO_24 = 2670177; // from s16x16.h
471
472 // Convert 4 angles: mulhi_i32_4 does (i64*i64) >> 16
474
475 // Call vectorized sincos
477
478 // Shift results right by 15 to convert from raw sin32 output to Q16.16
479 out_sin = from_raw(simd::sra_i32_4(sc.sin_vals, 15));
480 out_cos = from_raw(simd::sra_i32_4(sc.cos_vals, 15));
481 }
482
487 return sin_out;
488 }
489
494 return cos_out;
495 }
496};
497
498// Include simd_ops.h to implement cross-type operations
499// Must come after all types are defined
500#include "fl/math/fixed_point/simd_ops.h" // allow-include-after-namespace
501
502} // namespace fl
FL_DISABLE_WARNING_PUSH U constexpr common_type_t< T, U > min(T a, U b) FL_NOEXCEPT
Memory functions are available in fl:: namespace via fl/stl/cstring.h Using declarations cannot work ...
Definition math.h:71
constexpr common_type_t< T, U > max(T a, U b) FL_NOEXCEPT
Definition math.h:75
constexpr enable_if< is_fixed_point< T >::value, T >::type abs(T x) FL_NOEXCEPT
FASTLED_FORCE_INLINE CRGB * operator+(const CRGBSet &pixels, int offset)
Retrieve a pointer to a CRGB array, using a CRGBSet and an LED offset.
Definition pixelset.h:488
Cross-type SIMD fixed-point operations (implemented after all types are defined)