X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flibpspp%2Fmisc.h;h=c2f865d90c95512d7ec4d3517c68dff96e0181d4;hb=b5c82cc9aabe7e641011130240ae1b2e84348e23;hp=3b02515709ca9969c8d67eab5c9c2210e4822d1e;hpb=c3ac5a8af9c449072c7e872ca70a78c1755ae309;p=pspp-builds.git diff --git a/src/libpspp/misc.h b/src/libpspp/misc.h index 3b025157..c2f865d9 100644 --- a/src/libpspp/misc.h +++ b/src/libpspp/misc.h @@ -77,4 +77,23 @@ maximize (double *dest, double src) *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 */