33template <
typename Type>
37 operator Type()
const {
return simd.get (idx); }
54template <
typename Scalar>
57 using vSIMDType =
typename SIMDNativeOps<Scalar>::vSIMDType;
59 static vSIMDType JUCE_VECTOR_CALLTYPE load (
const Scalar* a)
noexcept
61 return SIMDNativeOps<Scalar>::load (a);
64 static void JUCE_VECTOR_CALLTYPE store (vSIMDType value, Scalar* dest)
noexcept
66 SIMDNativeOps<Scalar>::store (value, dest);
69 static vSIMDType JUCE_VECTOR_CALLTYPE expand (Scalar s)
noexcept
71 return SIMDNativeOps<Scalar>::expand (s);
74 static Scalar JUCE_VECTOR_CALLTYPE get (vSIMDType v,
std::size_t i)
noexcept
76 return SIMDNativeOps<Scalar>::get (v, i);
79 static vSIMDType JUCE_VECTOR_CALLTYPE set (vSIMDType v,
std::size_t i, Scalar s)
noexcept
81 return SIMDNativeOps<Scalar>::set (v, i, s);
84 static Scalar JUCE_VECTOR_CALLTYPE sum (vSIMDType a)
noexcept
86 return SIMDNativeOps<Scalar>::sum (a);
89 static vSIMDType JUCE_VECTOR_CALLTYPE mul (vSIMDType a, vSIMDType b)
noexcept
91 return SIMDNativeOps<Scalar>::mul (a, b);
94 static vSIMDType JUCE_VECTOR_CALLTYPE muladd (vSIMDType a, vSIMDType b, vSIMDType c)
noexcept
96 return SIMDNativeOps<Scalar>::multiplyAdd (a, b, c);
101template <
typename Scalar>
104 using vSIMDType =
typename SIMDNativeOps<Scalar>::vSIMDType;
108 return SIMDNativeOps<Scalar>::load (
reinterpret_cast<const Scalar*
> (a));
113 SIMDNativeOps<Scalar>::store (value,
reinterpret_cast<Scalar*
> (dest));
118 const int n =
sizeof (vSIMDType) /
sizeof (Scalar);
123 Scalar floats[(
size_t) n];
126 for (
int i = 0; i < n; ++i)
127 u.floats[i] = (i & 1) == 0 ? s.real() : s.imag();
135 return std::complex<Scalar> (SIMDNativeOps<Scalar>::get (v, j), SIMDNativeOps<Scalar>::get (v, j + 1));
141 return SIMDNativeOps<Scalar>::set (SIMDNativeOps<Scalar>::set (v, j, s.real()), j + 1, s.imag());
146 vSIMDType result = SIMDNativeOps<Scalar>::oddevensum (a);
147 auto* ptr =
reinterpret_cast<const Scalar*
> (&result);
151 static vSIMDType JUCE_VECTOR_CALLTYPE mul (vSIMDType a, vSIMDType b)
noexcept
153 return SIMDNativeOps<Scalar>::cmplxmul (a, b);
156 static vSIMDType JUCE_VECTOR_CALLTYPE muladd (vSIMDType a, vSIMDType b, vSIMDType c)
noexcept
158 return SIMDNativeOps<Scalar>::add (a, SIMDNativeOps<Scalar>::cmplxmul (b, c));
166 template <
typename Type>
173template <
typename Type>
174inline dsp::SIMDRegister<Type> JUCE_VECTOR_CALLTYPE
jmin (dsp::SIMDRegister<Type> a, dsp::SIMDRegister<Type> b) {
return dsp::SIMDRegister<Type>::min (a, b); }
175template <
typename Type>
176inline dsp::SIMDRegister<Type> JUCE_VECTOR_CALLTYPE
jmax (dsp::SIMDRegister<Type> a, dsp::SIMDRegister<Type> b) {
return dsp::SIMDRegister<Type>::max (a, b); }
auto & get(ProcessorChain< Processors... > &chain) noexcept
Non-member equivalent of ProcessorChain::get which avoids awkward member template syntax.
constexpr Type jmin(Type a, Type b)
Returns the smaller of two values.
constexpr Type jmax(Type a, Type b)
Returns the larger of two values.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
A wrapper around the platform's native SIMD register type.
typename NativeOps::vSIMDType vSIMDType
The native type (used internally).
SIMDRegister &JUCE_VECTOR_CALLTYPE operator=(ElementType s) noexcept
Broadcasts the scalar to all elements of the receiver.
static SIMDRegister JUCE_VECTOR_CALLTYPE max(SIMDRegister a, SIMDRegister b) noexcept
Returns a new vector where each element is the maximum of the corresponding element of a and b.
static SIMDRegister JUCE_VECTOR_CALLTYPE min(SIMDRegister a, SIMDRegister b) noexcept
Returns a new vector where each element is the minimum of the corresponding element of a and b.
void JUCE_VECTOR_CALLTYPE set(size_t idx, ElementType v) noexcept
Sets the idx-th element of the receiver.