mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-10-23 01:42:56 -05:00
MathUtil: Convert Clamp into a constexpr function
This commit is contained in:
@@ -31,8 +31,7 @@ static s16 ADPDecodeSample(s32 bits, s32 q, s32& hist1, s32& hist2)
|
||||
hist = (hist1 * 0x62) - (hist2 * 0x37);
|
||||
break;
|
||||
}
|
||||
hist = (hist + 0x20) >> 6;
|
||||
MathUtil::Clamp(&hist, -0x200000, 0x1fffff);
|
||||
hist = MathUtil::Clamp((hist + 0x20) >> 6, -0x200000, 0x1fffff);
|
||||
|
||||
s32 cur = (((s16)(bits << 12) >> (q & 0xf)) << 6) + hist;
|
||||
|
||||
@@ -40,7 +39,7 @@ static s16 ADPDecodeSample(s32 bits, s32 q, s32& hist1, s32& hist2)
|
||||
hist1 = cur;
|
||||
|
||||
cur >>= 6;
|
||||
MathUtil::Clamp(&cur, -0x8000, 0x7fff);
|
||||
cur = MathUtil::Clamp(cur, -0x8000, 0x7fff);
|
||||
|
||||
return (s16)cur;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user