From 2bd4f90b475d9511aaca77d581595db4349acdc8 Mon Sep 17 00:00:00 2001 From: dwarning Date: Wed, 19 Nov 2008 19:47:04 +0000 Subject: [PATCH] use well defined macros for min/max instead of fct's --- src/frontend/measure.c | 16 +--------------- src/frontend/numparam/xpressn.c | 18 ++---------------- 2 files changed, 3 insertions(+), 31 deletions(-) diff --git a/src/frontend/measure.c b/src/frontend/measure.c index 1cfeb9f2e..8b24995a9 100644 --- a/src/frontend/measure.c +++ b/src/frontend/measure.c @@ -1,4 +1,3 @@ -#include #include "ngspice.h" #include "cpdefs.h" #include "ftedefs.h" @@ -13,19 +12,6 @@ static bool measure_valid[20000]; static bool just_chk_meas; static bool measures_passed; -#if !defined(_MSC_VER) -static double -max( double a, double b ) { - if ( a > b ) return a; - else return b; -} - -static double -min( double a, double b ) { - if ( a < b ) return a; - else return b; -} -#endif static int get_measure_precision() @@ -140,7 +126,7 @@ measure2( char *meas_type, char *vec_name, char vec_type, double from, double to *result = vec->v_realdata[i]; *result_time = time->v_realdata[i]; } else { - *result = ( strcmp( meas_type, "max" ) == 0 ) ? max( *result, vec->v_realdata[i] ) : min( *result, vec->v_realdata[i] ); + *result = ( strcmp( meas_type, "max" ) == 0 ) ? MAX( *result, vec->v_realdata[i] ) : MIN( *result, vec->v_realdata[i] ); if ( !AlmostEqualUlps( prev_result, *result, 100 ) ) *result_time = time->v_realdata[i]; } } diff --git a/src/frontend/numparam/xpressn.c b/src/frontend/numparam/xpressn.c index cb10ac39e..8546fc12d 100644 --- a/src/frontend/numparam/xpressn.c +++ b/src/frontend/numparam/xpressn.c @@ -15,20 +15,6 @@ static Str (150, keys); /* all my keywords */ static Str (150, fmath); /* all math functions */ -#ifndef _MSC_VER -static double -max (double x, double y) -{ - return (x > y) ? x : y; -} - -static double -min (double x, double y) -{ - return (x < y) ? x : y; -} -#endif - static double ternary_fcn (int conditional, double if_value, double else_value) { @@ -93,10 +79,10 @@ mathfunction (int f, double z, double x) y = exp (x * ln (fabs (z))); break; case 11: - y = max (x, z); + y = MAX (x, z); break; case 12: - y = min (x, z); + y = MIN (x, z); break; case 13: y = trunc (x);