medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 975fa20da6521f4bbb7f3c6a9707007d0a4bf15c
parent b8798f16cab356b63d046458ab6bcd144efff81b
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Thu Dec 22 22:28:52 +0200

Make templates inline

Diffstat:
intrinsics.h | 20++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/intrinsics.h b/intrinsics.h @@ -57,44 +57,44 @@ char ( &ArrayCountObj( const T ( & )[ N ] ) )[ N ]; #define CACHE_LINE_PADDING u8 CONCAT( cache_line_spacing, __COUNTER__ )[ CACHE_LINE_SIZE ] template< typename T > -T min( T a, T b ) { +inline T min( T a, T b ) { return a < b ? a : b; } template< typename T > -T max( T a, T b ) { +inline T max( T a, T b ) { return a > b ? a : b; } template< typename T > -T max( T a, T b, T c, T d ) { +inline T max( T a, T b, T c, T d ) { return max( max( max( a, b ), c ), d ); } template< typename T > -T min( T a, T b, T c, T d ) { +inline T min( T a, T b, T c, T d ) { return min( min( min( a, b ), c ), d ); } template< typename T > -T abs( T x ) { +inline T abs( T x ) { return x > 0 ? x : -x; } template< typename T > -T clamp( T x, T lo, T hi ) { +inline T clamp( T x, T lo, T hi ) { if( x < lo ) return lo; if( x > hi ) return hi; return x; } template< typename T > -T clamp01( T x ) { +inline T clamp01( T x ) { return clamp( x, T( 0 ), T( 1 ) ); } template< typename T > -T clamp11( T x ) { +inline T clamp11( T x ) { return clamp( x, T( -1 ), T( 1 ) ); } @@ -149,7 +149,7 @@ struct ScopeExit { }; template< typename F > -ScopeExit< F > MakeScopeExit( F f ) { +inline ScopeExit< F > MakeScopeExit( F f ) { return ScopeExit< F >( f ); }; #define SCOPE_EXIT( code ) auto CONCAT( SCOPE_EXIT_, __COUNTER__ ) = MakeScopeExit( [=]() { code; } ) @@ -166,7 +166,7 @@ struct SameType< T, T > { #define SAME_TYPE( S, T ) SameType< S, T >::value template< typename To, typename From > -To checked_cast( const From & from ) { +inline To checked_cast( const From & from ) { To result = To( from ); ASSERT( From( result ) == from ); return result;