File indexing completed on 2025-01-30 09:33:57
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef BOOST_ATOMIC_DETAIL_INT_SIZES_HPP_INCLUDED_
0015 #define BOOST_ATOMIC_DETAIL_INT_SIZES_HPP_INCLUDED_
0016
0017 #include <boost/atomic/detail/config.hpp>
0018
0019 #ifdef BOOST_HAS_PRAGMA_ONCE
0020 #pragma once
0021 #endif
0022
0023
0024 #if defined(__SIZEOF_SHORT__)
0025 #define BOOST_ATOMIC_DETAIL_SIZEOF_SHORT __SIZEOF_SHORT__
0026 #endif
0027 #if defined(__SIZEOF_INT__)
0028 #define BOOST_ATOMIC_DETAIL_SIZEOF_INT __SIZEOF_INT__
0029 #endif
0030 #if defined(__SIZEOF_LONG__)
0031 #define BOOST_ATOMIC_DETAIL_SIZEOF_LONG __SIZEOF_LONG__
0032 #endif
0033 #if defined(__SIZEOF_LONG_LONG__)
0034 #define BOOST_ATOMIC_DETAIL_SIZEOF_LLONG __SIZEOF_LONG_LONG__
0035 #endif
0036 #if defined(__SIZEOF_WCHAR_T__)
0037 #define BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T __SIZEOF_WCHAR_T__
0038 #endif
0039 #if defined(__SIZEOF_POINTER__)
0040 #define BOOST_ATOMIC_DETAIL_SIZEOF_POINTER __SIZEOF_POINTER__
0041 #elif defined(_MSC_VER)
0042 #if defined(_M_AMD64) || defined(_M_ARM64) || defined(_M_IA64)
0043 #define BOOST_ATOMIC_DETAIL_SIZEOF_POINTER 8
0044 #else
0045 #define BOOST_ATOMIC_DETAIL_SIZEOF_POINTER 4
0046 #endif
0047 #endif
0048
0049 #if !defined(BOOST_ATOMIC_DETAIL_SIZEOF_SHORT) || !defined(BOOST_ATOMIC_DETAIL_SIZEOF_INT) ||\
0050 !defined(BOOST_ATOMIC_DETAIL_SIZEOF_LONG) || !defined(BOOST_ATOMIC_DETAIL_SIZEOF_LLONG) ||\
0051 !defined(BOOST_ATOMIC_DETAIL_SIZEOF_POINTER)
0052
0053
0054 #include <limits.h>
0055 #if defined(__has_include)
0056 #if __has_include(<stdint.h>)
0057 #include <stdint.h>
0058 #endif
0059 #endif
0060 #include <boost/cstdint.hpp>
0061
0062 #if !defined(BOOST_ATOMIC_DETAIL_SIZEOF_SHORT)
0063 #if (USHRT_MAX + 0) == 0xff
0064 #define BOOST_ATOMIC_DETAIL_SIZEOF_SHORT 1
0065 #elif (USHRT_MAX + 0) == 0xffff
0066 #define BOOST_ATOMIC_DETAIL_SIZEOF_SHORT 2
0067 #elif (USHRT_MAX + 0) == 0xffffffff
0068 #define BOOST_ATOMIC_DETAIL_SIZEOF_SHORT 4
0069 #elif (USHRT_MAX + 0) == UINT64_C(0xffffffffffffffff)
0070 #define BOOST_ATOMIC_DETAIL_SIZEOF_SHORT 8
0071 #endif
0072 #endif
0073
0074 #if !defined(BOOST_ATOMIC_DETAIL_SIZEOF_INT)
0075 #if (UINT_MAX + 0) == 0xff
0076 #define BOOST_ATOMIC_DETAIL_SIZEOF_INT 1
0077 #elif (UINT_MAX + 0) == 0xffff
0078 #define BOOST_ATOMIC_DETAIL_SIZEOF_INT 2
0079 #elif (UINT_MAX + 0) == 0xffffffff
0080 #define BOOST_ATOMIC_DETAIL_SIZEOF_INT 4
0081 #elif (UINT_MAX + 0) == UINT64_C(0xffffffffffffffff)
0082 #define BOOST_ATOMIC_DETAIL_SIZEOF_INT 8
0083 #endif
0084 #endif
0085
0086 #if !defined(BOOST_ATOMIC_DETAIL_SIZEOF_LONG)
0087 #if (ULONG_MAX + 0) == 0xff
0088 #define BOOST_ATOMIC_DETAIL_SIZEOF_LONG 1
0089 #elif (ULONG_MAX + 0) == 0xffff
0090 #define BOOST_ATOMIC_DETAIL_SIZEOF_LONG 2
0091 #elif (ULONG_MAX + 0) == 0xffffffff
0092 #define BOOST_ATOMIC_DETAIL_SIZEOF_LONG 4
0093 #elif (ULONG_MAX + 0) == UINT64_C(0xffffffffffffffff)
0094 #define BOOST_ATOMIC_DETAIL_SIZEOF_LONG 8
0095 #endif
0096 #endif
0097
0098 #if !defined(BOOST_ATOMIC_DETAIL_SIZEOF_LLONG)
0099 #if defined(__hpux)
0100 #define BOOST_ATOMIC_DETAIL_SIZEOF_LLONG 8
0101 #else
0102
0103
0104 #if defined(ULLONG_MAX)
0105 #define BOOST_ATOMIC_DETAIL_ULLONG_MAX ULLONG_MAX
0106 #elif defined(ULONG_LONG_MAX)
0107 #define BOOST_ATOMIC_DETAIL_ULLONG_MAX ULONG_LONG_MAX
0108 #elif defined(ULONGLONG_MAX)
0109 #define BOOST_ATOMIC_DETAIL_ULLONG_MAX ULONGLONG_MAX
0110 #elif defined(_LLONG_MAX)
0111 #define BOOST_ATOMIC_DETAIL_ULLONG_MAX _LLONG_MAX
0112 #endif
0113
0114 #if (BOOST_ATOMIC_DETAIL_ULLONG_MAX + 0) == 0xff
0115 #define BOOST_ATOMIC_DETAIL_SIZEOF_LLONG 1
0116 #elif (BOOST_ATOMIC_DETAIL_ULLONG_MAX + 0) == 0xffff
0117 #define BOOST_ATOMIC_DETAIL_SIZEOF_LLONG 2
0118 #elif (BOOST_ATOMIC_DETAIL_ULLONG_MAX + 0) == 0xffffffff
0119 #define BOOST_ATOMIC_DETAIL_SIZEOF_LLONG 4
0120 #elif (BOOST_ATOMIC_DETAIL_ULLONG_MAX + 0) == UINT64_C(0xffffffffffffffff)
0121 #define BOOST_ATOMIC_DETAIL_SIZEOF_LLONG 8
0122 #endif
0123
0124 #endif
0125 #endif
0126
0127 #if !defined(BOOST_ATOMIC_DETAIL_SIZEOF_POINTER) && defined(UINTPTR_MAX)
0128 #if (UINTPTR_MAX + 0) == 0xffff
0129 #define BOOST_ATOMIC_DETAIL_SIZEOF_POINTER 2
0130 #elif (UINTPTR_MAX + 0) == 0xffffffff
0131 #define BOOST_ATOMIC_DETAIL_SIZEOF_POINTER 4
0132 #elif (UINTPTR_MAX + 0) == UINT64_C(0xffffffffffffffff)
0133 #define BOOST_ATOMIC_DETAIL_SIZEOF_POINTER 8
0134 #endif
0135 #endif
0136
0137 #endif
0138
0139 #if !defined(BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T)
0140
0141 #include <wchar.h>
0142 #include <boost/cstdint.hpp>
0143
0144 #if defined(_MSC_VER) && (_MSC_VER <= 1310 || defined(UNDER_CE) && _MSC_VER <= 1500)
0145
0146 #define BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T 2
0147 #elif (WCHAR_MAX + 0) == 0xff || (WCHAR_MAX + 0) == 0x7f
0148 #define BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T 1
0149 #elif (WCHAR_MAX + 0) == 0xffff || (WCHAR_MAX + 0) == 0x7fff
0150 #define BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T 2
0151 #elif (WCHAR_MAX + 0) == 0xffffffff || (WCHAR_MAX + 0) == 0x7fffffff
0152 #define BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T 4
0153 #elif (WCHAR_MAX + 0) == UINT64_C(0xffffffffffffffff) || (WCHAR_MAX + 0) == INT64_C(0x7fffffffffffffff)
0154 #define BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T 8
0155 #endif
0156 #endif
0157
0158 #if !defined(BOOST_ATOMIC_DETAIL_SIZEOF_SHORT) || !defined(BOOST_ATOMIC_DETAIL_SIZEOF_INT) ||\
0159 !defined(BOOST_ATOMIC_DETAIL_SIZEOF_LONG) || !defined(BOOST_ATOMIC_DETAIL_SIZEOF_LLONG) ||\
0160 !defined(BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T)
0161 #error Boost.Atomic: Failed to determine builtin integer sizes, the target platform is not supported. Please, report to the developers (patches are welcome).
0162 #endif
0163
0164 #endif