Browse Source

Fixes for templated code which could default-initialise a SIMDRegister object while expecting to get a zero-initialised value

tags/2021-05-28
jules 8 years ago
parent
commit
7dd8fa993e
5 changed files with 12 additions and 11 deletions
  1. +4
    -4
      modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h
  2. +4
    -4
      modules/juce_core/maths/juce_MathsFunctions.h
  3. +1
    -1
      modules/juce_dsp/frequency/juce_Windowing.cpp
  4. +2
    -2
      modules/juce_dsp/maths/juce_Polynomial.h
  5. +1
    -0
      modules/juce_dsp/native/juce_avx_SIMDNativeOps.h

+ 4
- 4
modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h View File

@@ -984,7 +984,7 @@ public:
jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size);
if (isClear)
return {};
return { Type (0), Type (0) };
return FloatVectorOperations::findMinAndMax (channels[channel] + startSample, numSamples);
}
@@ -996,7 +996,7 @@ public:
jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size);
if (isClear)
return {};
return Type (0);
auto r = findMinMax (channel, startSample, numSamples);
@@ -1006,7 +1006,7 @@ public:
/** Finds the highest absolute sample value within a region on all channels. */
Type getMagnitude (int startSample, int numSamples) const noexcept
{
Type mag = {};
Type mag (0);
if (! isClear)
for (int i = 0; i < numChannels; ++i)
@@ -1022,7 +1022,7 @@ public:
jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size);
if (numSamples <= 0 || channel < 0 || channel >= numChannels || isClear)
return {};
return Type (0);
auto* data = channels[channel] + startSample;
double sum = 0.0;


+ 4
- 4
modules/juce_core/maths/juce_MathsFunctions.h View File

@@ -135,7 +135,7 @@ template <typename Type>
Type findMinimum (const Type* data, int numValues)
{
if (numValues <= 0)
return {};
return Type (0);
auto result = *data++;
@@ -155,7 +155,7 @@ template <typename Type>
Type findMaximum (const Type* values, int numValues)
{
if (numValues <= 0)
return {};
return Type (0);
auto result = *values++;
@@ -176,8 +176,8 @@ void findMinAndMax (const Type* values, int numValues, Type& lowest, Type& highe
{
if (numValues <= 0)
{
lowest = {};
highest = {};
lowest = Type (0);
highest = Type (0);
}
else
{


+ 1
- 1
modules/juce_dsp/frequency/juce_Windowing.cpp View File

@@ -153,7 +153,7 @@ void WindowingFunction<FloatType>::fillWindowingTables (FloatType* samples, size
// DC frequency amplitude must be one
if (normalize)
{
FloatType sum = {};
FloatType sum (0);
for (size_t i = 0; i < size; ++i)
sum += samples[i];


+ 2
- 2
modules/juce_dsp/maths/juce_Polynomial.h View File

@@ -90,7 +90,7 @@ public:
FloatingType operator() (FloatingType x) const noexcept
{
// Horner's method
FloatingType y = 0;
FloatingType y (0);
for (int i = coeffs.size(); --i >= 0;)
y = (x * y) + coeffs.getUnchecked(i);
@@ -144,7 +144,7 @@ public:
for (int i = 0; i < N; ++i)
{
FloatingType value = {};
FloatingType value (0);
for (int j = 0; j < Nmax; ++j)
if (j >= 0 && j < N1 && i - j >= 0 && i - j < N2)


+ 1
- 0
modules/juce_dsp/native/juce_avx_SIMDNativeOps.h View File

@@ -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 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 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 notEqual (__m256i a, __m256i b) noexcept { return bit_not (equal (a, b)); }


Loading…
Cancel
Save