commit 5b9522f26034be2ba803a0916d84e766e5ebc9fa parent 21519aab9fb8e53fdcb970f6eae31f268eef3aeb Author: Michael Savage <mikejsavage@gmail.com> Date: Tue Nov 15 00:07:35 +0200 Move min4/max4 to intrinsics Diffstat:
heightmap.cc | | | 10 | ---------- |
intrinsics.h | | | 10 | ++++++++++ |
diff --git a/heightmap.cc b/heightmap.cc @@ -72,16 +72,6 @@ float Heightmap::bilerp_height( float x, float y ) const { // // -template< typename T > -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 ) { - return min( min( min( a, b ), c ), d ); -} - bool ray_vs_aabb( AABB aabb, v3 start, v3 dir, float * t ) { if( aabb.contains( start ) ) { *t = 0.0f; diff --git a/intrinsics.h b/intrinsics.h @@ -66,6 +66,16 @@ T max( T a, T b ) { } template< typename T > +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 ) { + return min( min( min( a, b ), c ), d ); +} + +template< typename T > T abs( T x ) { return x > 0 ? x : -x; }