Imported Upstream version 0.5
[pysam.git] / tabix / msvc_compat.h
1 // Windows-specific code, include with:\r
2 // #ifdef _MSC_VER\r
3 // #include <msvc_compat.h>\r
4 // #endif\r
5 \r
6 //#define _CRT_SECURE_NO_WARNINGS\r
7 #ifndef MSVC_COMPAT_H\r
8 #define MSVC_COMPAT_H\r
9 \r
10 #define inline __inline\r
11 #define __func__ __FUNCTION__\r
12 \r
13 #include <float.h>\r
14 #define isnan _isnan\r
15 static int isinf(double x) {\r
16     int y = _finite(x);\r
17     if(y == 0) {\r
18        return 0;\r
19     } else {\r
20        return 1;\r
21     }\r
22 }\r
23 #define alloca _alloca\r
24 #define atoll _atoi64\r
25 \r
26 #define ftello ftell\r
27
28 typedef int bool;\r
29 \r
30 static int R_OK = 4;
31 \r
32 #ifndef lgamma\r
33 /* Log gamma function\r
34  * \log{\Gamma(z)}\r
35  * AS245, 2nd algorithm, http://lib.stat.cmu.edu/apstat/245\r
36  */\r
37 static double lgamma(double z)\r
38 {\r
39         double x = 0;\r
40         x += 0.1659470187408462e-06 / (z+7);\r
41         x += 0.9934937113930748e-05 / (z+6);\r
42         x -= 0.1385710331296526     / (z+5);\r
43         x += 12.50734324009056      / (z+4);\r
44         x -= 176.6150291498386      / (z+3);\r
45         x += 771.3234287757674      / (z+2);\r
46         x -= 1259.139216722289      / (z+1);\r
47         x += 676.5203681218835      / z;\r
48         x += 0.9999999999995183;\r
49         return log(x) - 5.58106146679532777 - z + (z-0.5) * log(z+6.5);\r
50 }\r
51 #endif\r
52 \r
53 #ifndef M_LN10\r
54 #define         M_LN10   2.30258509299404568402\r
55 #endif\r
56 #ifndef M_LN2\r
57 #define         M_LN2   0.69314718055994530942\r
58 #endif\r
59
60 #endif\r