C++ main module for mmsd Package  1.0
types.h
Go to the documentation of this file.
1 #ifndef TYPES_H
2 #define TYPES_H
3 #include <algorithm>
4 #include <string>
5 #include <complex>
6 #include <assert.h>
7 #include <stdlib.h>
8 
9 
10 
11 using namespace std;
12 
13 #define null NULL
14 #define tFlag unsigned char
15 #define tShort short
16 
17 #ifndef tReal
18 #define tReal long double
19 #endif
20 
21 #define tRealFormat "%Lg"
22 
23 //#define tReal double
24 //#define tRealFormat "%lg"
25 
26 #if defined(WIN32) || defined(WIN64)
27 #define tLong long long int
28 #define tULong unsigned long long int
29 #else
30 #define tLong long int
31 #define tULong unsigned long int
32 #endif
33 
34 //max int : INT_MAX 2^15-1
35 //max long : LONG_MAX 2^31-1
36 //max size_t :ULONG_MAX 2^32-1
37 //max long long: LLONG_MAX 2^63-1
38 
39 #define tArrayIndex unsigned long long int
40 #define tArrayIndexMax (ULLONG_MAX/10)
41 
42 #define tVectorIndex size_t
43 #define tVectorIndexMax (ULONG_MAX/10)
44 
45 #define tInteger unsigned tLong
46 #define tRelativeInteger tLong
47 #define tInt int
48 #define tBoolean bool
49 #define tString string
50 #define tComplex complex<tReal>
51 #define tDoubleComplex complex<double>
52 #define tFloatComplex complex<float>
53 #define tCharacter char
54 #define tTime unsigned long long int
55 
56 #define EPS 1.e-12
57 #define EPS2 1.e-24
58 #define modZ(a,b) ( ( (a)>=0) ? (a)%(b) : (a)%(b)+(b) )
59 #define square(a) ( (a)*(a) )
60 #define iand(a,b) ( (a) & (b) )
61 
62 //#define max(a,b) (((a) > (b)) ? (a) : (b))
63 //#define min(a,b) (((a) < (b)) ? (a) : (b))
64 //#define modulo(a,b) ((a)-(b)*((tInteger)((a)/(b))))
65 #if defined(WIN32) || defined(WIN64)
66 #undef M_PI
67 #define M_PI 3.14159265358979323846
68 #endif
69 
70 #ifndef REAL_INFINITY
71 #define REAL_INFINITY 3.40282347e+38
72 // float Maximum number = 3.40282347e+38
73 // double Maximum number = 1.7976931348623157e+308
74 // long double Maximum number = 1.18973149535723176508575932662800702e+4932
75 
76 #endif
77 #ifndef REAL_EPS
78 #define REAL_EPS 9.62964972193617926527988971292463845e-35
79 // min value of x such as 1+x!=1
80 // float minimum number 5.96046519e-08
81 // double 1.1102230246251568e-16
82 // long double 9.62964972193617926527988971292463845e-35
83 #endif
84 
85 #ifdef PRINT
86 #define PRINT_(a) {cout<<a;}
87 #define PRINTLN_(a) {cout<<a<<"\n";}
88 #else
89 #define PRINT_(a) {}
90 #define PRINTLN_(a) {}
91 #endif
92 
93 #ifdef NDEBUG
94 #define ASSERT_IN(a) {}
95 #else
96 #define ASSERT_IN(a) {assert(a);}
97 #endif
98 
99 #ifdef NDEBUG
100 #define ASSERT_OUT(a) {}
101 #else
102 #define ASSERT_OUT(a) {assert(a);}
103 #endif
104 
105 
106 
107 #endif