cctools
macros.h
1 /*
2 Copyright (C) 2003-2004 Douglas Thain and the University of Wisconsin
3 Copyright (C) 2005- The University of Notre Dame
4 This software is distributed under the GNU General Public License.
5 See the file COPYING for details.
6 */
7 
8 #ifndef MACROS_H
9 #define MACROS_H
10 
11 #ifndef MAX
12 #define MAX(a,b) ( ((a)>(b)) ? (a) : (b) )
13 #endif
14 
15 #ifndef MIN
16 #define MIN(a,b) ( ((a)<(b)) ? (a) : (b) )
17 #endif
18 
19 #ifndef ABS
20 #define ABS(x) ( ((x)>=0) ? (x) : (-(x)) )
21 #endif
22 
23 #define DIV_INT_ROUND_UP(a, b) (((a) + (b) - 1) / (b))
24 
25 #define KILO 1024
26 #define MEGA (KILO*KILO)
27 #define GIGA (KILO*MEGA)
28 #define TERA (KILO*GIGA)
29 #define PETA (KILO*TERA)
30 
31 #define KILOBYTE KILO
32 #define MEGABYTE MEGA
33 #define GIGABYTE GIGA
34 #define TERABYTE TERA
35 #define PETABYTE PETA
36 
37 #define USECOND 1000000
38 
39 #endif