]> git.cworth.org Git - vogl/blob - src/extlib/loki/include/loki/yasli/platform.h
Initial vogl checkin
[vogl] / src / extlib / loki / include / loki / yasli / platform.h
1 #ifndef YASLI_PLATFORM_H_
2 #define YASLI_PLATFORM_H_
3
4 // $Id: platform.h 754 2006-10-17 19:59:11Z syntheticpp $
5
6
7 // Most conservative
8
9 #define YASLI_HAS_EFFICIENT_MSIZE 0
10 #define YASLI_REALLOC_AFTER_NEW 0
11 #define YASLI_HAS_EXPAND 0
12
13 #include <malloc.h>
14
15 // Works on MSVC (all versions)
16 #if defined(_MSC_VER)
17
18 #if defined(NDEBUG)//why only if ndebug?
19 #undef YASLI_REALLOC_AFTER_NEW//this is not used: what is it's intention?
20 #define YASLI_REALLOC_AFTER_NEW 1
21
22 #undef YASLI_HAS_EFFICIENT_MSIZE
23 #define YASLI_HAS_EFFICIENT_MSIZE 1
24 #endif
25
26 // On Wintel platforms, uninit pointers can be copied
27 #define YASLI_UNDEFINED_POINTERS_COPYABLE 1
28
29 namespace yasli_platform
30 {
31 inline size_t msize(const void *p)
32 {
33         return _msize(const_cast<void *>(p));
34 }
35 }
36
37 #undef YASLI_HAS_EXPAND
38 #define YASLI_HAS_EXPAND 1
39 namespace yasli_platform
40 {
41 inline void *expand(const void *p, size_t s)
42 {
43         return _expand (const_cast<void *>(p), s);
44 }
45 }
46
47 #elif defined(__MINGW32_VERSION) && !defined(RC_INVOKED)
48 //I havinclude Malloc.h in order to find whether this library is Mingw32
49 //i.e. defines __MINGW32_VERSION,
50 //hmm, I really need to sort this out in earlier versions
51 //it was _STRICT_ANSI_ not RC_INVOKED but I don't know the details
52 #undef YASLI_HAS_EFFICIENT_MSIZE
53 #define YASLI_HAS_EFFICIENT_MSIZE 1
54 namespace yasli_platform
55 {
56 inline size_t msize(const void *p)
57 {
58         return _msize(const_cast<void *>(p));
59 }
60 }
61
62 #undef YASLI_HAS_EXPAND
63 #define YASLI_HAS_EXPAND 1
64 namespace yasli_platform
65 {
66 inline void *expand(const void *p, size_t s)
67 {
68         return _expand (const_cast<void *>(p), s);
69 }
70 }
71
72 #define YASLI_UNDEFINED_POINTERS_COPYABLE 1 //well it appears to compile ok anyway
73 #endif
74
75
76
77
78
79 #endif // YASLI_PLATFORM_H_