X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Flibpspp%2Fmisc.h;h=1698297dc4cc51a2694f55d831c740d4eb601694;hb=0df9cdd3df66caf4353128feff3008289cda8115;hp=e33d588fd8c0db6ca722278eb3c77260a6081d82;hpb=a9afcdd223cc1c1b7889601e405cff0bd47300d7;p=pspp
diff --git a/src/libpspp/misc.h b/src/libpspp/misc.h
index e33d588fd8..1698297dc4 100644
--- a/src/libpspp/misc.h
+++ b/src/libpspp/misc.h
@@ -14,9 +14,10 @@
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
#include
@@ -60,4 +61,42 @@ 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;
+}
+
+int c_dtoastr (char *buf, size_t bufsize, int flags, int width, double x);
+
+
+#endif /* libpspp/misc.h */