8#include <QtCore/qprocessordetection.h>
9#include <QtCore/qsystemdetection.h>
10#include <QtCore/qtconfigmacros.h>
11#include <QtCore/qassert.h>
15# if defined(_HAS_STD_BYTE) && _HAS_STD_BYTE == 0
16# error "Qt requires std::byte, but _HAS_STD_BYTE has been set to 0"
19# if defined(__STDCPP_FLOAT16_T__) && __has_include(<stdfloat>)
23# include <type_traits>
29#pragma qt_class(QtTypes)
30#pragma qt_class(QIntegerForSize)
31#pragma qt_sync_stop_processing
35
36
45
46
47
48
59# define Q_INT64_C(c) static_cast<long long>(c ## LL)
60# define Q_UINT64_C(c) static_cast<unsigned long long>(c ## ULL)
62# define Q_INT64_C(c) ((long long)(c ## LL))
63# define Q_UINT64_C(c) ((unsigned long long)(c ## ULL))
72# define QT_SUPPORTS_INT128 16
73#elif defined(QT_COMPILER_SUPPORTS_INT128) && !defined(QT_NO_INT128)
74# define QT_SUPPORTS_INT128 QT_COMPILER_SUPPORTS_INT128
75# if defined(__GLIBCXX__) && defined(__STRICT_ANSI__)
76# undef QT_SUPPORTS_INT128
78# if defined(__clang__) && defined(_MSVC_STL_VERSION)
79# undef QT_SUPPORTS_INT128
82# undef QT_SUPPORTS_INT128
85#if defined(QT_SUPPORTS_INT128)
86__extension__ typedef __int128_t qint128;
87__extension__ typedef __uint128_t quint128;
90static_assert(std::is_signed_v<qint128>,
91 "Qt requires <type_traits> and <limits> to work for q(u)int128.");
96# define QT_C_STYLE_CAST(type, x) static_cast<type>(x)
98# define QT_C_STYLE_CAST(type, x) ((type)(x))
100# ifndef Q_UINT128_MAX
101# define Q_UINT128_MAX QT_C_STYLE_CAST(quint128, -1
)
103# define Q_INT128_MAX QT_C_STYLE_CAST(qint128, Q_UINT128_MAX / 2
)
104# define Q_INT128_MIN (-Q_INT128_MAX - 1
)
107 namespace QtPrivate::NumberLiterals {
109 template <quint128 accu,
int base>
110 constexpr quint128 construct() {
return accu; }
112 template <quint128 accu,
int base,
char C,
char...Cs>
113 constexpr quint128 construct()
115 if constexpr (C !=
'\'') {
116 const int digitValue =
'0' <= C && C <=
'9' ? C -
'0' :
117 'a' <= C && C <=
'z' ? C -
'a' + 10 :
118 'A' <= C && C <=
'Z' ? C -
'A' + 10 :
120 static_assert(digitValue >= 0 && digitValue < base,
121 "Invalid character");
123 static_assert(accu <= (Q_UINT128_MAX - digitValue) / base,
124 "Overflow occurred");
125 return construct<accu * base + digitValue, base, Cs...>();
127 return construct<accu, base, Cs...>();
131 template <
char C,
char...Cs>
132 constexpr quint128 parse0xb()
134 constexpr quint128 accu = 0;
135 if constexpr (C ==
'x' || C ==
'X')
136 return construct<accu, 16, Cs...>();
137 else if constexpr (C ==
'b' || C ==
'B')
138 return construct<accu, 2, Cs...>();
140 return construct<accu, 8, C, Cs...>();
144 constexpr quint128 parse0()
146 if constexpr (
sizeof...(Cs) == 0)
149 return parse0xb<Cs...>();
152 template <
char C,
char...Cs>
153 constexpr quint128 parse()
155 if constexpr (C ==
'0')
156 return parse0<Cs...>();
158 return construct<0, 10, C, Cs...>();
162 constexpr quint128 operator
""_quint128()
noexcept
163 {
return QtPrivate::NumberLiterals::detail::parse<Cs...>(); }
165 constexpr qint128 operator
""_qint128()
noexcept
166 {
return qint128(QtPrivate::NumberLiterals::detail::parse<Cs...>()); }
169 # define Q_UINT128_C(c) ([]{ using namespace QtPrivate::NumberLiterals; return c ## _quint128; }())
172 # define Q_INT128_C(c) ([]{ using namespace QtPrivate::NumberLiterals; return c ## _qint128; }())
181static_assert(
sizeof(ptrdiff_t) ==
sizeof(size_t),
"Weird ptrdiff_t and size_t definitions");
182typedef ptrdiff_t qptrdiff;
183typedef ptrdiff_t qsizetype;
184typedef ptrdiff_t qintptr;
185typedef size_t quintptr;
187#define PRIdQPTRDIFF "td"
188#define PRIiQPTRDIFF "ti"
190#define PRIdQSIZETYPE "td"
191#define PRIiQSIZETYPE "ti"
193#define PRIdQINTPTR "td"
194#define PRIiQINTPTR "ti"
196#define PRIuQUINTPTR "zu"
197#define PRIoQUINTPTR "zo"
198#define PRIxQUINTPTR "zx"
199#define PRIXQUINTPTR "zX"
202#if defined(QT_COORD_TYPE)
203typedef QT_COORD_TYPE qreal;
208#if defined(__cplusplus
)
210
211
212
213
214
215
216
217
218template <
int>
struct QIntegerForSize;
219template <>
struct QIntegerForSize<1> {
typedef quint8 Unsigned;
typedef qint8 Signed; };
220template <>
struct QIntegerForSize<2> {
typedef quint16 Unsigned;
typedef qint16 Signed; };
221template <>
struct QIntegerForSize<4> {
typedef quint32 Unsigned;
typedef qint32 Signed; };
222template <>
struct QIntegerForSize<8> {
typedef quint64 Unsigned;
typedef qint64 Signed; };
223#if defined(QT_SUPPORTS_INT128)
224template <>
struct QIntegerForSize<16> {
typedef quint128 Unsigned;
typedef qint128 Signed; };
226template <
class T>
struct QIntegerForSizeof: QIntegerForSize<
sizeof(T)> { };
227typedef QIntegerForSize<Q_PROCESSOR_WORDSIZE>::Signed qregisterint;
228typedef QIntegerForSize<Q_PROCESSOR_WORDSIZE>::Unsigned qregisteruint;
229typedef QIntegerForSizeof<
void *>::Unsigned quintptr;
230typedef QIntegerForSizeof<
void *>::Signed qptrdiff;
231typedef qptrdiff qintptr;
232using qsizetype = QIntegerForSizeof<std::size_t>::Signed;
243#if SIZE_MAX
== 0xffffffffULL
244#define PRIuQUINTPTR "u"
245#define PRIoQUINTPTR "o"
246#define PRIxQUINTPTR "x"
247#define PRIXQUINTPTR "X"
249#define PRIdQPTRDIFF "d"
250#define PRIiQPTRDIFF "i"
252#define PRIdQINTPTR "d"
253#define PRIiQINTPTR "i"
255#define PRIdQSIZETYPE "d"
256#define PRIiQSIZETYPE "i"
257#elif SIZE_MAX
== 0xffffffffffffffffULL
258#define PRIuQUINTPTR "llu"
259#define PRIoQUINTPTR "llo"
260#define PRIxQUINTPTR "llx"
261#define PRIXQUINTPTR "llX"
263#define PRIdQPTRDIFF "lld"
264#define PRIiQPTRDIFF "lli"
266#define PRIdQINTPTR "lld"
267#define PRIiQINTPTR "lli"
269#define PRIdQSIZETYPE "lld"
270#define PRIiQSIZETYPE "lli"
272#error Unsupported platform (unknown value for SIZE_MAX)
277#if defined(__STDCPP_FLOAT16_T__)
278# define QFLOAT16_IS_NATIVE 1
280#elif defined(Q_CC_CLANG) && defined(__FLT16_MAX__
) && 0
282# define QFLOAT16_IS_NATIVE 1
284#elif defined(Q_CC_GNU_ONLY) && defined(__FLT16_MAX__
) && defined(__ARM_FP16_FORMAT_IEEE)
285# define QFLOAT16_IS_NATIVE 1
287#elif defined(Q_CC_GNU_ONLY) && defined(__FLT16_MAX__
) && defined(__SSE2__
)
288# define QFLOAT16_IS_NATIVE 1
291# define QFLOAT16_IS_NATIVE 0
292using NativeFloat16Type =
void;
unsigned long long quint64
QT_BEGIN_NAMESPACE typedef signed char qint8