MathUtil: Convert Clamp into a constexpr function
This commit is contained in:
1 parent
c5685ba53a
commit
b9e360df7b
13 files changed
+43
-70
No files matched your search
@@ -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