libsmbios_c library
win64.hpp
Go to the documentation of this file.
1 // (C) Copyright John Maddock 2001 - 2003.
2 // (C) Copyright Bill Kempf 2001.
3 // (C) Copyright Aleksey Gurtovoy 2003.
4 // Use, modification and distribution are subject to the
5 // Boost Software License, Version 1.0. (See accompanying file
6 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 
8 // See http://www.boost.org for most recent version.
9 
10 // Win64 specific config options:
11 
12 #define LIBSMBIOS_PLATFORM "Win64"
13 #define LIBSMBIOS_PLATFORM_WIN64
14 
15 // Windows has a special platform-specific smbios table accessor method
16 // that can be used if generic memory access fails.
17 #define LIBSMBIOS_HAS_ARCH_TABLE_CLASS
18 
19 // Enable 64-bit file access (changes off_t to 64-bit)
20 #ifndef FSEEK
21 #define FSEEK(fh, pos, whence) fseek(fh, static_cast<long>(pos), whence)
22 #endif
23 
24 #if defined(__GNUC__) && !defined(LIBSMBIOS_NO_SWPRINTF)
25 # define LIBSMBIOS_NO_SWPRINTF
26 #endif
27 
28 #if !defined(__GNUC__) && !defined(LIBSMBIOS_HAS_DECLSPEC)
29 # define LIBSMBIOS_HAS_DECLSPEC
30 #endif
31 
32 #if defined(__MINGW32__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
33 # define LIBSMBIOS_HAS_STDINT_H
34 # define __STDC_LIMIT_MACROS
35 #endif
36 
37 // workaround for broken namespace on win64 compiler
38 #define LIBSMBIOS_NO_STDC_NAMESPACE
39 
40 //
41 // Win64 will normally be using native Win64 threads,
42 // but there is a pthread library available as an option,
43 // we used to disable this when LIBSMBIOS_DISABLE_WIN64 was
44 // defined but no longer - this should allow some
45 // files to be compiled in strict mode - while maintaining
46 // a consistent setting of LIBSMBIOS_HAS_THREADS across
47 // all translation units (needed for shared_ptr etc).
48 //
49 #ifndef LIBSMBIOS_HAS_PTHREADS
50 # define LIBSMBIOS_HAS_WINTHREADS
51 #endif
52 
53 #ifndef LIBSMBIOS_DISABLE_WIN64
54 // WEK: Added
55 #define LIBSMBIOS_HAS_FTIME
56 
57 #endif
58 
59 //
60 // disable min/max macros:
61 //
62 #ifdef min
63 # undef min
64 #endif
65 #ifdef max
66 # undef max
67 #endif
68 #ifndef NOMINMAX
69 # define NOMINMAX
70 #endif
71 
72 #ifdef LIBSMBIOS_MSVC
73 #include <algorithm> // for existing std::min and std::max
74 namespace std{
75  // Apparently, something in the Microsoft libraries requires the "long"
76  // overload, because it calls the min/max functions with arguments of
77  // slightly different type. (If this proves to be incorrect, this
78  // whole "LIBSMBIOS_MSVC" section can be removed.)
79  inline long min(long __a, long __b) {
80  return __b < __a ? __b : __a;
81  }
82  inline long max(long __a, long __b) {
83  return __a < __b ? __b : __a;
84  }
85  // The "long double" overload is required, otherwise user code calling
86  // min/max for floating-point numbers will use the "long" overload.
87  // (SourceForge bug #495495)
88  inline long double min(long double __a, long double __b) {
89  return __b < __a ? __b : __a;
90  }
91  inline long double max(long double __a, long double __b) {
92  return __a < __b ? __b : __a;
93  }
94 }
95 using std::min;
96 using std::max;
97 # endif
98 
99