-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathglobal_defines.h
46 lines (37 loc) · 1.92 KB
/
global_defines.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/******************************************************************************************/
/**** FILE: global_defines.h ****/
/**** Michael Mandell 2006.06.16 ****/
/******************************************************************************************/
#ifndef GLOBAL_DEFINES_H
#define GLOBAL_DEFINES_H
#define MAX_LINE_SIZE 50000 /* Max num chars in input line */
#define CHDELIM " \t\n" /* Delimiting characters, used for string parsing */
#define PI 3.1415926535897932384626433832795029
#define IVECTOR(nn) (int *) ( (nn) ? malloc((nn) *sizeof(int) ) : NULL )
#define DVECTOR(nn) (double *) ( (nn) ? malloc((nn) *sizeof(double)) : NULL )
#define CVECTOR(nn) (char *) ( (nn) ? malloc(((nn)+1)*sizeof(char) ) : NULL )
#define CORE_DUMP printf("%d", *((int *) NULL))
/******************************************************************************************/
#define BITWIDTH(www, nnn) { \
int tmp; \
tmp = (nnn); \
www = 0; \
while (tmp) { \
www++; \
tmp>>=1; \
} \
}
#define MOD(m, n) ( (m) >= 0 ? (m)%(n) : ((n)-1) - ((-(m)-1)%(n)) )
#define DIV(m, n) ( \
((m) >= 0)&&((n) >= 0) ? (m)/(n) : \
((m) < 0)&&((n) < 0) ? (-(m))/(-(n)) : \
((m) < 0)&&((n) >= 0) ? -((-(m)-1)/(n) + 1) : \
-(((m)-1)/(-(n)) + 1) )
#ifdef __linux__
#define LONGLONG_TYPE long long
#define FPATH_SEPARATOR '/'
#else
#define LONGLONG_TYPE __int64
#define FPATH_SEPARATOR '\\'
#endif
#endif