mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-14 20:00:49 +00:00
- clamp(): Remove definition in compat.h and uplift definition in templates.h.
This commit is contained in:
parent
8be8bcc87a
commit
90e711464a
2 changed files with 4 additions and 5 deletions
|
@ -189,7 +189,6 @@ static FORCE_INLINE uint16_t B_UNBUF16(void const * const buf) { return *(uint16
|
||||||
|
|
||||||
////////// Abstract data operations //////////
|
////////// Abstract data operations //////////
|
||||||
|
|
||||||
template <typename T, typename X, typename Y> constexpr T clamp(T in, X min, Y max) { return in <= (T) min ? (T) min : (in >= (T) max ? (T) max : in); }
|
|
||||||
using std::min;
|
using std::min;
|
||||||
using std::max;
|
using std::max;
|
||||||
|
|
||||||
|
|
|
@ -136,11 +136,11 @@ const T MAX (const T a, const T b)
|
||||||
// Clamps in to the range [min,max].
|
// Clamps in to the range [min,max].
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
template<class T>
|
template<typename T, typename X, typename Y>
|
||||||
inline
|
inline constexpr
|
||||||
T clamp (const T in, const T min, const T max)
|
T clamp (const T in, const X min, const Y max)
|
||||||
{
|
{
|
||||||
return in <= min ? min : in >= max ? max : in;
|
return in <= (T) min ? (T) min : in >= (T) max ? (T) max : in;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //__TEMPLATES_H__
|
#endif //__TEMPLATES_H__
|
||||||
|
|
Loading…
Reference in a new issue