medfall

A super great game engine
Log | Files | Refs

commit e43066663cad873b8e004f0dc4cf49bcb8ea6564
parent d4919997d29c007a8a95c92476528dba7bd604cc
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Fri,  2 Aug 2019 20:01:56 +0300

swap -> swap2

Diffstat:
Mheightmap.cc | 16+++++-----------
Mintrinsics.h | 2+-
2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/heightmap.cc b/heightmap.cc @@ -145,31 +145,25 @@ static size_t child_idx( size_t node_idx, size_t quadrant ) { return node_idx * 4 + quadrant + 1; } -static void swap( int * a, int * b ) { - float t = *a; - *a = *b; - *b = t; -} - static void sort4( int * indices, float * elems ) { for( int i = 0; i < 4; i++ ) indices[ i ] = i; // sort a/b and c/d if( elems[ indices[ 0 ] ] > elems[ indices[ 1 ] ] ) - swap( &indices[ 0 ], &indices[ 1 ] ); + swap2( indices[ 0 ], indices[ 1 ] ); if( elems[ indices[ 2 ] ] > elems[ indices[ 3 ] ] ) - swap( &indices[ 2 ], &indices[ 3 ] ); + swap2( indices[ 2 ], indices[ 3 ] ); // find lowest and highest if( elems[ indices[ 0 ] ] > elems[ indices[ 2 ] ] ) - swap( &indices[ 0 ], &indices[ 2 ] ); + swap2( indices[ 0 ], indices[ 2 ] ); if( elems[ indices[ 1 ] ] > elems[ indices[ 3 ] ] ) - swap( &indices[ 1 ], &indices[ 3 ] ); + swap2( indices[ 1 ], indices[ 3 ] ); // sort middle two if( elems[ indices[ 1 ] ] > elems[ indices[ 2 ] ] ) - swap( &indices[ 1 ], &indices[ 2 ] ); + swap2( indices[ 1 ], indices[ 2 ] ); } static bool ray_vs_quadtree_node( diff --git a/intrinsics.h b/intrinsics.h @@ -84,7 +84,7 @@ char ( &ArrayCountObj( const T ( & )[ N ] ) )[ N ]; #define gigabytes( gb ) ( megabytes( gb ) * size_t( 1024 ) ) template< typename T > -void swap( T & a, T & b ) { +void swap2( T & a, T & b ) { T t = a; a = b; b = t;