Backport from sid to buster
[hcoop/debian/mlton.git] / runtime / util.h
1 /* Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh
2 * Jagannathan, and Stephen Weeks.
3 * Copyright (C) 1997-2000 NEC Research Institute.
4 *
5 * MLton is released under a BSD-style license.
6 * See the file MLton-LICENSE for details.
7 */
8
9 #ifndef _MLTON_UTIL_H_
10 #define _MLTON_UTIL_H_
11
12 #include "cenv.h"
13 #include "util/pointer.h"
14
15 #ifndef TRUE
16 #define TRUE (0 == 0)
17 #endif
18 #ifndef FALSE
19 #define FALSE (not TRUE)
20 #endif
21 #define unless(p) if (not (p))
22 #define until(p) while (not (p))
23 #define cardof(a) (sizeof(a) / sizeof(*(a)))
24 #define endof(a) ((a) + cardof(a))
25
26 #define TWOPOWER(n) (1 << (n))
27
28 #ifndef max
29 #define max(a, b) ((a)>(b)?(a):(b))
30 #endif
31
32 #ifndef min
33 #define min(a, b) ((a)<(b)?(a):(b))
34 #endif
35
36 #include "util/die.h"
37 #include "util/safe.h"
38 #include "util/read_write.h"
39 #include "util/to-string.h"
40 #include "util/align.h"
41 #include "util/endian.h"
42
43 #endif /* _MLTON_UTIL_H_ */