Replace MathUtil::Clamp with its std counterpart

This commit is contained in:
fearlessTobi
2018-07-24 19:08:17 +02:00
parent 14878a17d9
commit 7a3e126a4f
17 changed files with 49 additions and 72 deletions

View File

@@ -8,7 +8,6 @@
#include "audio_core/hle/filter.h"
#include "audio_core/hle/shared_memory.h"
#include "common/common_types.h"
#include "common/math_util.h"
namespace AudioCore {
namespace HLE {
@@ -68,7 +67,7 @@ std::array<s16, 2> SourceFilters::SimpleFilter::ProcessSample(const std::array<s
std::array<s16, 2> y0;
for (size_t i = 0; i < 2; i++) {
const s32 tmp = (b0 * x0[i] + a1 * y1[i]) >> 15;
y0[i] = MathUtil::Clamp(tmp, -32768, 32767);
y0[i] = std::clamp(tmp, -32768, 32767);
}
y1 = y0;
@@ -102,7 +101,7 @@ std::array<s16, 2> SourceFilters::BiquadFilter::ProcessSample(const std::array<s
std::array<s16, 2> y0;
for (size_t i = 0; i < 2; i++) {
const s32 tmp = (b0 * x0[i] + b1 * x1[i] + b2 * x2[i] + a1 * y1[i] + a2 * y2[i]) >> 14;
y0[i] = MathUtil::Clamp(tmp, -32768, 32767);
y0[i] = std::clamp(tmp, -32768, 32767);
}
x2 = x1;

View File

@@ -7,7 +7,6 @@
#include "audio_core/hle/mixers.h"
#include "common/assert.h"
#include "common/logging/log.h"
#include "common/math_util.h"
namespace AudioCore {
namespace HLE {
@@ -87,7 +86,7 @@ void Mixers::ParseConfig(DspConfiguration& config) {
}
static s16 ClampToS16(s32 value) {
return static_cast<s16>(MathUtil::Clamp(value, -32768, 32767));
return static_cast<s16>(std::clamp(value, -32768, 32767));
}
static std::array<s16, 2> AddAndClampToS16(const std::array<s16, 2>& a,