Replace MathUtil::Clamp with std::clamp

This commit is contained in:
Léo Lam
2017-12-26 00:38:44 +01:00
parent 6f84984b7b
commit ab9ece9bca
31 changed files with 101 additions and 109 deletions

View File

@ -4,11 +4,12 @@
// Adapted from in_cube by hcs & destop
#include <algorithm>
#include "Core/HW/StreamADPCM.h"
#include "Common/ChunkFile.h"
#include "Common/CommonTypes.h"
#include "Common/MathUtil.h"
namespace StreamADPCM
{
@ -30,7 +31,7 @@ static s16 ADPDecodeSample(s32 bits, s32 q, s32& hist1, s32& hist2)
hist = (hist1 * 0x62) - (hist2 * 0x37);
break;
}
hist = MathUtil::Clamp((hist + 0x20) >> 6, -0x200000, 0x1fffff);
hist = std::clamp((hist + 0x20) >> 6, -0x200000, 0x1fffff);
s32 cur = (((s16)(bits << 12) >> (q & 0xf)) << 6) + hist;
@ -38,7 +39,7 @@ static s16 ADPDecodeSample(s32 bits, s32 q, s32& hist1, s32& hist2)
hist1 = cur;
cur >>= 6;
cur = MathUtil::Clamp(cur, -0x8000, 0x7fff);
cur = std::clamp(cur, -0x8000, 0x7fff);
return (s16)cur;
}