blob: 1e89ed09a3e1a246cda72e90a3a18f87d8c095ed (
plain) (
blame)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
/**
* @file
* @brief Header file for MSVC compiles
**/
#ifndef __msvc_h
#define __msvc_h
#if defined(TARGET_COMPILER_VC)
#define __STDC_FORMAT_MACROS
//now included via tweaking include directories
//#include "MSVC/inttypes.h"
#include <io.h>
#include <math.h>
#define fileno _fileno
#define snprintf _snprintf
#define strdup _strdup
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#define strnicmp _strnicmp
#define ftruncate _chsize
#define putenv _putenv
#define strtoll _strtoi64
// No va_copy in MSVC
#if !defined(va_copy)
#define va_copy(dst, src) \
((void) memcpy(&(dst), &(src), sizeof(va_list)))
#endif
// These are not defined in MSVC version of stat.h
#define S_IWUSR S_IWRITE
#define S_IRUSR S_IREAD
#pragma warning(disable : 4290)
#pragma warning(disable : 4351)
// bool -> int
#pragma warning(disable : 4800)
// struct vs class XXX: fix these some day!
#pragma warning(disable : 4099)
// truncating conversions XXX: fix these too!
#pragma warning(disable : 4244)
// POSIX deprecation warnings
#pragma warning(disable : 4996)
static inline double round(double x)
{
if (x >= 0.0)
return floor(x + 0.5);
else
return ceil(x - 0.5);
}
static inline double sqrt(int x)
{
return sqrt((double)x);
}
static inline double atan2(int x, int y)
{
return atan2((double)x, (double)y);
}
static inline double pow(int x, double y)
{
return pow((double)x, y);
}
static inline double pow(int x, int y)
{
return pow((double)x, y);
}
static inline double log(int x)
{
return log((double)x);
}
static inline double log2(double n)
{
return log(n) / log(2.0);
}
//this is targeting for struct member name in store.h, nothing else gets affected as of 0.9.0
#define _int64 var_int64
//missing in sys/types.h
#define mode_t unsigned short
typedef ptrdiff_t ssize_t;
#endif /* defined(TARGET_COMPILER_VC) */
#endif
|