mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Fixes for templated code which could default-initialise a SIMDRegister object while expecting to get a zero-initialised value
This commit is contained in:
parent
8f02179bbf
commit
7dd8fa993e
5 changed files with 12 additions and 11 deletions
|
|
@ -984,7 +984,7 @@ public:
|
||||||
jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size);
|
jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size);
|
||||||
|
|
||||||
if (isClear)
|
if (isClear)
|
||||||
return {};
|
return { Type (0), Type (0) };
|
||||||
|
|
||||||
return FloatVectorOperations::findMinAndMax (channels[channel] + startSample, numSamples);
|
return FloatVectorOperations::findMinAndMax (channels[channel] + startSample, numSamples);
|
||||||
}
|
}
|
||||||
|
|
@ -996,7 +996,7 @@ public:
|
||||||
jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size);
|
jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size);
|
||||||
|
|
||||||
if (isClear)
|
if (isClear)
|
||||||
return {};
|
return Type (0);
|
||||||
|
|
||||||
auto r = findMinMax (channel, startSample, numSamples);
|
auto r = findMinMax (channel, startSample, numSamples);
|
||||||
|
|
||||||
|
|
@ -1006,7 +1006,7 @@ public:
|
||||||
/** Finds the highest absolute sample value within a region on all channels. */
|
/** Finds the highest absolute sample value within a region on all channels. */
|
||||||
Type getMagnitude (int startSample, int numSamples) const noexcept
|
Type getMagnitude (int startSample, int numSamples) const noexcept
|
||||||
{
|
{
|
||||||
Type mag = {};
|
Type mag (0);
|
||||||
|
|
||||||
if (! isClear)
|
if (! isClear)
|
||||||
for (int i = 0; i < numChannels; ++i)
|
for (int i = 0; i < numChannels; ++i)
|
||||||
|
|
@ -1022,7 +1022,7 @@ public:
|
||||||
jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size);
|
jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size);
|
||||||
|
|
||||||
if (numSamples <= 0 || channel < 0 || channel >= numChannels || isClear)
|
if (numSamples <= 0 || channel < 0 || channel >= numChannels || isClear)
|
||||||
return {};
|
return Type (0);
|
||||||
|
|
||||||
auto* data = channels[channel] + startSample;
|
auto* data = channels[channel] + startSample;
|
||||||
double sum = 0.0;
|
double sum = 0.0;
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ template <typename Type>
|
||||||
Type findMinimum (const Type* data, int numValues)
|
Type findMinimum (const Type* data, int numValues)
|
||||||
{
|
{
|
||||||
if (numValues <= 0)
|
if (numValues <= 0)
|
||||||
return {};
|
return Type (0);
|
||||||
|
|
||||||
auto result = *data++;
|
auto result = *data++;
|
||||||
|
|
||||||
|
|
@ -155,7 +155,7 @@ template <typename Type>
|
||||||
Type findMaximum (const Type* values, int numValues)
|
Type findMaximum (const Type* values, int numValues)
|
||||||
{
|
{
|
||||||
if (numValues <= 0)
|
if (numValues <= 0)
|
||||||
return {};
|
return Type (0);
|
||||||
|
|
||||||
auto result = *values++;
|
auto result = *values++;
|
||||||
|
|
||||||
|
|
@ -176,8 +176,8 @@ void findMinAndMax (const Type* values, int numValues, Type& lowest, Type& highe
|
||||||
{
|
{
|
||||||
if (numValues <= 0)
|
if (numValues <= 0)
|
||||||
{
|
{
|
||||||
lowest = {};
|
lowest = Type (0);
|
||||||
highest = {};
|
highest = Type (0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ void WindowingFunction<FloatType>::fillWindowingTables (FloatType* samples, size
|
||||||
// DC frequency amplitude must be one
|
// DC frequency amplitude must be one
|
||||||
if (normalize)
|
if (normalize)
|
||||||
{
|
{
|
||||||
FloatType sum = {};
|
FloatType sum (0);
|
||||||
|
|
||||||
for (size_t i = 0; i < size; ++i)
|
for (size_t i = 0; i < size; ++i)
|
||||||
sum += samples[i];
|
sum += samples[i];
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ public:
|
||||||
FloatingType operator() (FloatingType x) const noexcept
|
FloatingType operator() (FloatingType x) const noexcept
|
||||||
{
|
{
|
||||||
// Horner's method
|
// Horner's method
|
||||||
FloatingType y = 0;
|
FloatingType y (0);
|
||||||
|
|
||||||
for (int i = coeffs.size(); --i >= 0;)
|
for (int i = coeffs.size(); --i >= 0;)
|
||||||
y = (x * y) + coeffs.getUnchecked(i);
|
y = (x * y) + coeffs.getUnchecked(i);
|
||||||
|
|
@ -144,7 +144,7 @@ public:
|
||||||
|
|
||||||
for (int i = 0; i < N; ++i)
|
for (int i = 0; i < N; ++i)
|
||||||
{
|
{
|
||||||
FloatingType value = {};
|
FloatingType value (0);
|
||||||
|
|
||||||
for (int j = 0; j < Nmax; ++j)
|
for (int j = 0; j < Nmax; ++j)
|
||||||
if (j >= 0 && j < N1 && i - j >= 0 && i - j < N2)
|
if (j >= 0 && j < N1 && i - j >= 0 && i - j < N2)
|
||||||
|
|
|
||||||
|
|
@ -190,6 +190,7 @@ struct SIMDNativeOps<int8_t>
|
||||||
static forcedinline __m256i JUCE_VECTOR_CALLTYPE equal (__m256i a, __m256i b) noexcept { return _mm256_cmpeq_epi8 (a, b); }
|
static forcedinline __m256i JUCE_VECTOR_CALLTYPE equal (__m256i a, __m256i b) noexcept { return _mm256_cmpeq_epi8 (a, b); }
|
||||||
static forcedinline __m256i JUCE_VECTOR_CALLTYPE greaterThan (__m256i a, __m256i b) noexcept { return _mm256_cmpgt_epi8 (a, b); }
|
static forcedinline __m256i JUCE_VECTOR_CALLTYPE greaterThan (__m256i a, __m256i b) noexcept { return _mm256_cmpgt_epi8 (a, b); }
|
||||||
static forcedinline __m256i JUCE_VECTOR_CALLTYPE greaterThanOrEqual (__m256i a, __m256i b) noexcept { return bit_or (greaterThan (a, b), equal (a,b)); }
|
static forcedinline __m256i JUCE_VECTOR_CALLTYPE greaterThanOrEqual (__m256i a, __m256i b) noexcept { return bit_or (greaterThan (a, b), equal (a,b)); }
|
||||||
|
static forcedinline bool JUCE_VECTOR_CALLTYPE allEqual (__m256i a, __m256i b) noexcept { return _mm256_movemask_epi8 (equal (a, b)) == -1; }
|
||||||
static forcedinline __m256i JUCE_VECTOR_CALLTYPE multiplyAdd (__m256i a, __m256i b, __m256i c) noexcept { return add (a, mul (b, c)); }
|
static forcedinline __m256i JUCE_VECTOR_CALLTYPE multiplyAdd (__m256i a, __m256i b, __m256i c) noexcept { return add (a, mul (b, c)); }
|
||||||
static forcedinline __m256i JUCE_VECTOR_CALLTYPE notEqual (__m256i a, __m256i b) noexcept { return bit_not (equal (a, b)); }
|
static forcedinline __m256i JUCE_VECTOR_CALLTYPE notEqual (__m256i a, __m256i b) noexcept { return bit_not (equal (a, b)); }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue