X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flibpspp%2Fmisc.h;h=1698297dc4cc51a2694f55d831c740d4eb601694;hb=6d7eed1c12693a3688a3c16f634a5b816660085b;hp=3b02515709ca9969c8d67eab5c9c2210e4822d1e;hpb=d458c186c5395d900e9b3bc022abe4533fcc62df;p=pspp diff --git a/src/libpspp/misc.h b/src/libpspp/misc.h index 3b02515709..1698297dc4 100644 --- a/src/libpspp/misc.h +++ b/src/libpspp/misc.h @@ -17,6 +17,7 @@ #if !libpspp_misc_h #define libpspp_misc_h 1 +#include #include #include @@ -77,4 +78,25 @@ 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; +} + +int c_dtoastr (char *buf, size_t bufsize, int flags, int width, double x); + + #endif /* libpspp/misc.h */