1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

SIMDRegister abs operation implemented

This commit is contained in:
Zsolt Garamvolgyi 2019-03-12 15:26:27 +01:00 committed by Tom Poole
parent 56302416df
commit c3a8ea1ab6
2 changed files with 48 additions and 1 deletions

View file

@ -328,6 +328,13 @@ struct SIMDRegister
/** Returns a scalar which is the sum of all elements of the receiver. */
inline ElementType sum() const noexcept { return CmplxOps::sum (value); }
//==============================================================================
/** Returns the absolute value of each element. */
static inline SIMDRegister JUCE_VECTOR_CALLTYPE abs (SIMDRegister a) noexcept
{
return a - (a * (expand (ElementType (2)) & lessThan (a, expand (ElementType (0)))));
}
//==============================================================================
/** Checks if the given pointer is suffeciently aligned for using SIMD operations. */
static inline bool isSIMDAligned (const ElementType* ptr) noexcept