X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flibpspp%2Fmisc.h;h=c2f865d90c95512d7ec4d3517c68dff96e0181d4;hb=a1edd7f28a94b05b3fd48850e80dd0b96bead96e;hp=969b2621f043dbc9abfbca8e9b8c90edf937003b;hpb=f5c108becd49d78f4898cab11352291f5689d24e;p=pspp-builds.git diff --git a/src/libpspp/misc.h b/src/libpspp/misc.h index 969b2621..c2f865d9 100644 --- a/src/libpspp/misc.h +++ b/src/libpspp/misc.h @@ -1,47 +1,27 @@ -/* PSPP - computes sample statistics. +/* PSPP - a program for statistical analysis. Copyright (C) 1997-9, 2000 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. */ + along with this program. If not, see . */ -#if !math_misc_h -#define math_misc_h 1 +#if !libpspp_misc_h +#define libpspp_misc_h 1 #include #include #define EPSILON (10 * DBL_EPSILON) -/* HUGE_VAL is traditionally defined as positive infinity, or - alternatively, DBL_MAX. */ -#if !HAVE_ISINF && !defined isinf -#define isinf(X) (fabs (X) == HUGE_VAL) -#endif - -/* A Not a Number is not equal to itself. */ -#if !HAVE_ISNAN && !defined isnan -#define isnan(X) ((X) != (X)) -#endif - -/* Finite numbers are not infinities or NaNs. */ -#if !HAVE_FINITE && !defined finite -#define finite(X) (!isinf (X) && !isnan (X)) -#elif HAVE_IEEEFP_H -#include /* Declares finite() under Solaris. */ -#endif - /* Divides nonnegative X by positive Y, rounding up. */ #define DIV_RND_UP(X, Y) (((X) + ((Y) - 1)) / (Y)) @@ -80,4 +60,40 @@ pow4 (double x) return y; } -#endif /* math/misc.h */ +/* Set *DEST to the lower of *DEST and SRC */ +static inline void +minimize (double *dest, double src) +{ + if (src < *dest) + *dest = src; +} + + +/* Set *DEST to the greater of *DEST and SRC */ +static inline void +maximize (double *dest, double src) +{ + if (src > *dest) + *dest = src; +} + + +/* Set *DEST to the lower of *DEST and SRC */ +static inline void +minimize_int (int *dest, int src) +{ + if (src < *dest) + *dest = src; +} + + +/* Set *DEST to the greater of *DEST and SRC */ +static inline void +maximize_int (int *dest, int src) +{ + if (src > *dest) + *dest = src; +} + + +#endif /* libpspp/misc.h */