mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-11 10:39:59 +00:00
Introduce a generic clamp function to clean up some similarly duplicated code.
This commit is contained in:
parent
59e2179172
commit
6b87a0ef20
10 changed files with 43 additions and 61 deletions
|
@ -13,6 +13,15 @@
|
|||
|
||||
namespace MathUtil
|
||||
{
|
||||
template<class T>
|
||||
inline void Clamp(T& val, const T& min, const T& max)
|
||||
{
|
||||
if (val < min)
|
||||
val = min;
|
||||
else if (val > max)
|
||||
val = max;
|
||||
}
|
||||
|
||||
|
||||
static const u64 DOUBLE_SIGN = 0x8000000000000000ULL,
|
||||
DOUBLE_EXP = 0x7FF0000000000000ULL,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue