X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flibpspp%2Fmisc.h;fp=src%2Flibpspp%2Fmisc.h;h=3b02515709ca9969c8d67eab5c9c2210e4822d1e;hb=2acfe799af1fd4504ee1278e0b8864ace451688a;hp=e33d588fd8c0db6ca722278eb3c77260a6081d82;hpb=dca2f6d80dcb53dd1a12c675118d4b7e0716b292;p=pspp-builds.git diff --git a/src/libpspp/misc.h b/src/libpspp/misc.h index e33d588f..3b025157 100644 --- a/src/libpspp/misc.h +++ b/src/libpspp/misc.h @@ -14,8 +14,8 @@ You should have received a copy of the GNU General Public License 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 @@ -60,4 +60,21 @@ 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; +} + +#endif /* libpspp/misc.h */