remove min max macros (#1310)

* remove the MIN and MAX macros and use the std versions instead

* fix formatting

* fix Arm build

* remove additional MIN and MAX macros from compat.h
This commit is contained in:
Ben Ashbaugh
2021-09-13 05:25:32 -07:00
committed by GitHub
parent 1f26e1d8ba
commit 02bf24d2b1
31 changed files with 241 additions and 202 deletions

View File

@@ -21,6 +21,8 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <algorithm>
#include "procs.h"
#include "harness/testHarness.h"
#include "harness/errorHelpers.h"
@@ -29,12 +31,6 @@
typedef unsigned char uchar;
#endif
#undef MIN
#define MIN(x,y) ( (x) < (y) ? (x) : (y) )
#undef MAX
#define MAX(x,y) ( (x) > (y) ? (x) : (y) )
//#define CREATE_OUTPUT 1
extern int writePPM( const char *filename, uchar *buf, int xsize, int ysize );
@@ -73,8 +69,8 @@ static const char *image_filter_src =
static void read_imagef( int x, int y, int w, int h, int nChannels, uchar *src, float *srcRgb )
{
// clamp the coords
int x0 = MIN( MAX( x, 0 ), w - 1 );
int y0 = MIN( MAX( y, 0 ), h - 1 );
int x0 = std::min(std::max(x, 0), w - 1);
int y0 = std::min(std::max(y, 0), h - 1);
// get tine index
int indx = ( y0 * w + x0 ) * nChannels;