commit 1842e1bbad39c7ccab22eea836534873f10f482e parent b89389268bac23dffb475167cbc87a296aa862e1 Author: Michael Savage <mikejsavage@gmail.com> Date: Wed Aug 30 23:52:50 +0300 Make clamp a proper constexpr Diffstat:
intrinsics.h | | | 4 | +--- |
diff --git a/intrinsics.h b/intrinsics.h @@ -110,9 +110,7 @@ constexpr T abs( T x ) { template< typename T > constexpr T clamp( T x, T lo, T hi ) { - if( x < lo ) return lo; - if( x > hi ) return hi; - return x; + return x < lo ? lo : ( x > hi ? hi : x ); } template< typename T >