aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/ambdec.cpp2
-rw-r--r--core/cpu_caps.cpp2
-rw-r--r--core/except.cpp2
-rw-r--r--core/hrtf.cpp2
-rw-r--r--core/mastering.cpp14
-rw-r--r--core/mixer/mixer_sse.cpp22
6 files changed, 22 insertions, 22 deletions
diff --git a/core/ambdec.cpp b/core/ambdec.cpp
index 52a1df05..5e2de6af 100644
--- a/core/ambdec.cpp
+++ b/core/ambdec.cpp
@@ -53,7 +53,7 @@ al::optional<std::string> make_error(size_t linenum, const char *fmt, ...)
auto &str = ret.emplace();
str.resize(256);
- int printed{std::snprintf(&str[0], str.length(), "Line %zu: ", linenum)};
+ int printed{std::snprintf(const_cast<char*>(str.data()), str.length(), "Line %zu: ", linenum)};
if(printed < 0) printed = 0;
auto plen = std::min(static_cast<size_t>(printed), str.length());
diff --git a/core/cpu_caps.cpp b/core/cpu_caps.cpp
index 103d2437..d4b4d86c 100644
--- a/core/cpu_caps.cpp
+++ b/core/cpu_caps.cpp
@@ -32,7 +32,7 @@ using reg_type = unsigned int;
inline std::array<reg_type,4> get_cpuid(unsigned int f)
{
std::array<reg_type,4> ret{};
- __get_cpuid(f, &ret[0], &ret[1], &ret[2], &ret[3]);
+ __get_cpuid(f, ret.data(), &ret[1], &ret[2], &ret[3]);
return ret;
}
#define CAN_GET_CPUID
diff --git a/core/except.cpp b/core/except.cpp
index f3d80d59..ba4759a3 100644
--- a/core/except.cpp
+++ b/core/except.cpp
@@ -21,7 +21,7 @@ void base_exception::setMessage(const char* msg, std::va_list args)
if(msglen > 0) [[likely]]
{
mMessage.resize(static_cast<size_t>(msglen)+1);
- std::vsnprintf(&mMessage[0], mMessage.length(), msg, args2);
+ std::vsnprintf(const_cast<char*>(mMessage.data()), mMessage.length(), msg, args2);
mMessage.pop_back();
}
va_end(args2);
diff --git a/core/hrtf.cpp b/core/hrtf.cpp
index 28179189..ec42cbf4 100644
--- a/core/hrtf.cpp
+++ b/core/hrtf.cpp
@@ -257,7 +257,7 @@ void HrtfStore::getCoeffs(float elevation, float azimuth, float distance, float
delays[1] = fastf2u(d * float{1.0f/HrirDelayFracOne});
/* Calculate the blended HRIR coefficients. */
- float *coeffout{al::assume_aligned<16>(&coeffs[0][0])};
+ float *coeffout{al::assume_aligned<16>(coeffs[0].data())};
coeffout[0] = PassthruCoeff * (1.0f-dirfact);
coeffout[1] = PassthruCoeff * (1.0f-dirfact);
std::fill_n(coeffout+2, size_t{HrirLength-1}*2, 0.0f);
diff --git a/core/mastering.cpp b/core/mastering.cpp
index a4f66fbb..88a0b5e0 100644
--- a/core/mastering.cpp
+++ b/core/mastering.cpp
@@ -66,7 +66,7 @@ float UpdateSlidingHold(SlidingHold *Hold, const uint i, const float in)
goto found_place;
} while(lowerIndex--);
lowerIndex = mask;
- } while(1);
+ } while(true);
found_place:
lowerIndex = (lowerIndex + 1) & mask;
@@ -87,10 +87,10 @@ void ShiftSlidingHold(SlidingHold *Hold, const uint n)
if(exp_last-exp_begin < 0)
{
std::transform(exp_begin, std::end(Hold->mExpiries), exp_begin,
- std::bind(std::minus<>{}, _1, n));
+ [n](auto a){ return a - n; });
exp_begin = std::begin(Hold->mExpiries);
}
- std::transform(exp_begin, exp_last+1, exp_begin, std::bind(std::minus<>{}, _1, n));
+ std::transform(exp_begin, exp_last+1, exp_begin, [n](auto a){ return a - n; });
}
@@ -121,7 +121,7 @@ void LinkChannels(Compressor *Comp, const uint SamplesToDo, const FloatBufferLin
* it uses an instantaneous squared peak detector and a squared RMS detector
* both with 200ms release times.
*/
-static void CrestDetector(Compressor *Comp, const uint SamplesToDo)
+void CrestDetector(Compressor *Comp, const uint SamplesToDo)
{
const float a_crest{Comp->mCrestCoeff};
float y2_peak{Comp->mLastPeakSq};
@@ -155,7 +155,7 @@ void PeakDetector(Compressor *Comp, const uint SamplesToDo)
/* Clamp the minimum amplitude to near-zero and convert to logarithm. */
auto side_begin = std::begin(Comp->mSideChain) + Comp->mLookAhead;
std::transform(side_begin, side_begin+SamplesToDo, side_begin,
- [](const float s) -> float { return std::log(maxf(0.000001f, s)); });
+ [](auto s) { return std::log(maxf(0.000001f, s)); });
}
/* An optional hold can be used to extend the peak detector so it can more
@@ -404,7 +404,7 @@ void Compressor::process(const uint SamplesToDo, FloatBufferLine *OutBuffer)
{
float *buffer{al::assume_aligned<16>(input.data())};
std::transform(buffer, buffer+SamplesToDo, buffer,
- std::bind(std::multiplies<float>{}, _1, preGain));
+ [preGain](auto a){ return a * preGain; });
};
std::for_each(OutBuffer, OutBuffer+numChans, apply_gain);
}
@@ -430,7 +430,7 @@ void Compressor::process(const uint SamplesToDo, FloatBufferLine *OutBuffer)
float *buffer{al::assume_aligned<16>(input.data())};
const float *gains{al::assume_aligned<16>(&sideChain[0])};
std::transform(gains, gains+SamplesToDo, buffer, buffer,
- std::bind(std::multiplies<float>{}, _1, _2));
+ [](auto a, auto b){ return a * b; });
};
std::for_each(OutBuffer, OutBuffer+numChans, apply_comp);
diff --git a/core/mixer/mixer_sse.cpp b/core/mixer/mixer_sse.cpp
index 6baad7fb..1b0d1386 100644
--- a/core/mixer/mixer_sse.cpp
+++ b/core/mixer/mixer_sse.cpp
@@ -40,36 +40,36 @@ inline void ApplyCoeffs(float2 *RESTRICT Values, const size_t IrSize, const Cons
{
for(size_t i{0};i < IrSize;i += 2)
{
- const __m128 coeffs{_mm_load_ps(&Coeffs[i][0])};
- __m128 vals{_mm_load_ps(&Values[i][0])};
+ const __m128 coeffs{_mm_load_ps(Coeffs[i].data())};
+ __m128 vals{_mm_load_ps(Values[i].data())};
vals = MLA4(vals, lrlr, coeffs);
- _mm_store_ps(&Values[i][0], vals);
+ _mm_store_ps(Values[i].data(), vals);
}
}
else
{
__m128 imp0, imp1;
- __m128 coeffs{_mm_load_ps(&Coeffs[0][0])};
- __m128 vals{_mm_loadl_pi(_mm_setzero_ps(), reinterpret_cast<__m64*>(&Values[0][0]))};
+ __m128 coeffs{_mm_load_ps(Coeffs[0].data())};
+ __m128 vals{_mm_loadl_pi(_mm_setzero_ps(), reinterpret_cast<__m64*>(Values[0].data()))};
imp0 = _mm_mul_ps(lrlr, coeffs);
vals = _mm_add_ps(imp0, vals);
- _mm_storel_pi(reinterpret_cast<__m64*>(&Values[0][0]), vals);
+ _mm_storel_pi(reinterpret_cast<__m64*>(Values[0].data()), vals);
size_t td{((IrSize+1)>>1) - 1};
size_t i{1};
do {
- coeffs = _mm_load_ps(&Coeffs[i+1][0]);
- vals = _mm_load_ps(&Values[i][0]);
+ coeffs = _mm_load_ps(Coeffs[i+1].data());
+ vals = _mm_load_ps(Values[i].data());
imp1 = _mm_mul_ps(lrlr, coeffs);
imp0 = _mm_shuffle_ps(imp0, imp1, _MM_SHUFFLE(1, 0, 3, 2));
vals = _mm_add_ps(imp0, vals);
- _mm_store_ps(&Values[i][0], vals);
+ _mm_store_ps(Values[i].data(), vals);
imp0 = imp1;
i += 2;
} while(--td);
- vals = _mm_loadl_pi(vals, reinterpret_cast<__m64*>(&Values[i][0]));
+ vals = _mm_loadl_pi(vals, reinterpret_cast<__m64*>(Values[i].data()));
imp0 = _mm_movehl_ps(imp0, imp0);
vals = _mm_add_ps(imp0, vals);
- _mm_storel_pi(reinterpret_cast<__m64*>(&Values[i][0]), vals);
+ _mm_storel_pi(reinterpret_cast<__m64*>(Values[i].data()), vals);
}
}