assert( l < h ) in CLAMP
This commit is contained in:
@@ -41,18 +41,21 @@ inline U lerp( T x, U l, U h )
|
|||||||
|
|
||||||
inline bool CLAMP( int &x, int l, int h )
|
inline bool CLAMP( int &x, int l, int h )
|
||||||
{
|
{
|
||||||
|
ASSERT( l <= h );
|
||||||
if (x > h) { x = h; return true; }
|
if (x > h) { x = h; return true; }
|
||||||
else if (x < l) { x = l; return true; }
|
else if (x < l) { x = l; return true; }
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
inline bool CLAMP( unsigned &x, unsigned l, unsigned h )
|
inline bool CLAMP( unsigned &x, unsigned l, unsigned h )
|
||||||
{
|
{
|
||||||
|
ASSERT( l <= h );
|
||||||
if (x > h) { x = h; return true; }
|
if (x > h) { x = h; return true; }
|
||||||
else if (x < l) { x = l; return true; }
|
else if (x < l) { x = l; return true; }
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
inline bool CLAMP( float &x, float l, float h )
|
inline bool CLAMP( float &x, float l, float h )
|
||||||
{
|
{
|
||||||
|
ASSERT( l <= h );
|
||||||
if (x > h) { x = h; return true; }
|
if (x > h) { x = h; return true; }
|
||||||
else if (x < l) { x = l; return true; }
|
else if (x < l) { x = l; return true; }
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user