diff options
author | Chris Robinson <[email protected]> | 2019-01-11 21:04:50 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-01-11 21:04:50 -0800 |
commit | f8c2e54b47476dd245bb87e09bd1c5b5ddd2cd9f (patch) | |
tree | b749ad93fe51adc2baf96ce6578e6f8d2218adaf /OpenAL32/Include | |
parent | 77447fcd542d0e27b0e19caa666c0246c0cb05d2 (diff) |
Make the min/max/clamp functions constexpr
Diffstat (limited to 'OpenAL32/Include')
-rw-r--r-- | OpenAL32/Include/alu.h | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index ec809589..eef7126d 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -306,53 +306,53 @@ using HrtfDirectMixerFunc = void(*)(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT #define FRACTIONMASK (FRACTIONONE-1) -inline ALfloat minf(ALfloat a, ALfloat b) noexcept +constexpr inline ALfloat minf(ALfloat a, ALfloat b) noexcept { return ((a > b) ? b : a); } -inline ALfloat maxf(ALfloat a, ALfloat b) noexcept +constexpr inline ALfloat maxf(ALfloat a, ALfloat b) noexcept { return ((a > b) ? a : b); } -inline ALfloat clampf(ALfloat val, ALfloat min, ALfloat max) noexcept +constexpr inline ALfloat clampf(ALfloat val, ALfloat min, ALfloat max) noexcept { return minf(max, maxf(min, val)); } -inline ALdouble mind(ALdouble a, ALdouble b) noexcept +constexpr inline ALdouble mind(ALdouble a, ALdouble b) noexcept { return ((a > b) ? b : a); } -inline ALdouble maxd(ALdouble a, ALdouble b) noexcept +constexpr inline ALdouble maxd(ALdouble a, ALdouble b) noexcept { return ((a > b) ? a : b); } -inline ALdouble clampd(ALdouble val, ALdouble min, ALdouble max) noexcept +constexpr inline ALdouble clampd(ALdouble val, ALdouble min, ALdouble max) noexcept { return mind(max, maxd(min, val)); } -inline ALuint minu(ALuint a, ALuint b) noexcept +constexpr inline ALuint minu(ALuint a, ALuint b) noexcept { return ((a > b) ? b : a); } -inline ALuint maxu(ALuint a, ALuint b) noexcept +constexpr inline ALuint maxu(ALuint a, ALuint b) noexcept { return ((a > b) ? a : b); } -inline ALuint clampu(ALuint val, ALuint min, ALuint max) noexcept +constexpr inline ALuint clampu(ALuint val, ALuint min, ALuint max) noexcept { return minu(max, maxu(min, val)); } -inline ALint mini(ALint a, ALint b) noexcept +constexpr inline ALint mini(ALint a, ALint b) noexcept { return ((a > b) ? b : a); } -inline ALint maxi(ALint a, ALint b) noexcept +constexpr inline ALint maxi(ALint a, ALint b) noexcept { return ((a > b) ? a : b); } -inline ALint clampi(ALint val, ALint min, ALint max) noexcept +constexpr inline ALint clampi(ALint val, ALint min, ALint max) noexcept { return mini(max, maxi(min, val)); } -inline ALint64 mini64(ALint64 a, ALint64 b) noexcept +constexpr inline ALint64 mini64(ALint64 a, ALint64 b) noexcept { return ((a > b) ? b : a); } -inline ALint64 maxi64(ALint64 a, ALint64 b) noexcept +constexpr inline ALint64 maxi64(ALint64 a, ALint64 b) noexcept { return ((a > b) ? a : b); } -inline ALint64 clampi64(ALint64 val, ALint64 min, ALint64 max) noexcept +constexpr inline ALint64 clampi64(ALint64 val, ALint64 min, ALint64 max) noexcept { return mini64(max, maxi64(min, val)); } -inline ALuint64 minu64(ALuint64 a, ALuint64 b) noexcept +constexpr inline ALuint64 minu64(ALuint64 a, ALuint64 b) noexcept { return ((a > b) ? b : a); } -inline ALuint64 maxu64(ALuint64 a, ALuint64 b) noexcept +constexpr inline ALuint64 maxu64(ALuint64 a, ALuint64 b) noexcept { return ((a > b) ? a : b); } -inline ALuint64 clampu64(ALuint64 val, ALuint64 min, ALuint64 max) noexcept +constexpr inline ALuint64 clampu64(ALuint64 val, ALuint64 min, ALuint64 max) noexcept { return minu64(max, maxu64(min, val)); } -inline size_t minz(size_t a, size_t b) noexcept +constexpr inline size_t minz(size_t a, size_t b) noexcept { return ((a > b) ? b : a); } -inline size_t maxz(size_t a, size_t b) noexcept +constexpr inline size_t maxz(size_t a, size_t b) noexcept { return ((a > b) ? a : b); } -inline size_t clampz(size_t val, size_t min, size_t max) noexcept +constexpr inline size_t clampz(size_t val, size_t min, size_t max) noexcept { return minz(max, maxz(min, val)); } |