use well defined macros for min/max instead of fct's

This commit is contained in:
dwarning 2008-11-19 19:47:04 +00:00
parent 5b58cb39e5
commit 2bd4f90b47
2 changed files with 3 additions and 31 deletions

View File

@ -1,4 +1,3 @@
#include <stdlib.h>
#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];
}
}

View File

@ -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);