X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flibpspp%2Fmisc.h;h=1698297dc4cc51a2694f55d831c740d4eb601694;hb=85e8724e69cf54946c7b40628e88f2ec12368d7c;hp=f3afb1fb91a88b8d91fd7835a1ab754d95fa06c4;hpb=2287a5970f043d5e18ebaf0013d0a2968c6f6051;p=pspp diff --git a/src/libpspp/misc.h b/src/libpspp/misc.h index f3afb1fb91..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 @@ -35,8 +36,6 @@ /* Rounds X down to the previous multiple of Y. */ #define ROUND_DOWN(X, Y) ((X) / (Y) * (Y)) -#define SQR(X) ((X) * (X)) - int intlog10 (unsigned); /* Returns the square of X. */ @@ -79,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 */