Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qprocessordetection.qdoc
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5 \headerfile <QtProcessorDetection>
6 \inmodule QtCore
7 \title Architecture-specific Macro Definitions
8 \ingroup funclists
9
10 \brief The <QtProcessorDetection> header file includes various
11 architecture-specific macros.
12
13 The <QtProcessorDetection> header file declares a range of macros
14 (Q_PROCESSOR_*) that are defined if the application is compiled for
15 specified processor architectures. For example, the Q_PROCESSOR_X86 macro is
16 defined if the application is compiled for x86 processors.
17
18 The purpose of these macros is to enable programmers to add
19 architecture-specific code to their application.
20*/
21
22/*!
23 \macro Q_PROCESSOR_ALPHA
24 \relates <QtProcessorDetection>
25
26 Defined if the application is compiled for Alpha processors.
27
28 \sa QSysInfo::buildCpuArchitecture()
29*/
30
31/*!
32 \macro Q_PROCESSOR_ARM
33 \relates <QtProcessorDetection>
34
35 Defined if the application is compiled for ARM processors. Qt currently
36 supports three optional ARM revisions: \l Q_PROCESSOR_ARM_V5, \l
37 Q_PROCESSOR_ARM_V6, and \l Q_PROCESSOR_ARM_V7.
38
39 \sa QSysInfo::buildCpuArchitecture()
40*/
41/*!
42 \macro Q_PROCESSOR_ARM_V5
43 \relates <QtProcessorDetection>
44
45 Defined if the application is compiled for ARMv5 processors. The \l
46 Q_PROCESSOR_ARM macro is also defined when Q_PROCESSOR_ARM_V5 is defined.
47
48 \sa QSysInfo::buildCpuArchitecture()
49*/
50/*!
51 \macro Q_PROCESSOR_ARM_V6
52 \relates <QtProcessorDetection>
53
54 Defined if the application is compiled for ARMv6 processors. The \l
55 Q_PROCESSOR_ARM and \l Q_PROCESSOR_ARM_V5 macros are also defined when
56 Q_PROCESSOR_ARM_V6 is defined.
57
58 \sa QSysInfo::buildCpuArchitecture()
59*/
60/*!
61 \macro Q_PROCESSOR_ARM_V7
62 \relates <QtProcessorDetection>
63
64 Defined if the application is compiled for ARMv7 processors. The \l
65 Q_PROCESSOR_ARM, \l Q_PROCESSOR_ARM_V5, and \l Q_PROCESSOR_ARM_V6 macros
66 are also defined when Q_PROCESSOR_ARM_V7 is defined.
67
68 \sa QSysInfo::buildCpuArchitecture()
69*/
70
71/*!
72 \macro Q_PROCESSOR_AVR32
73 \relates <QtProcessorDetection>
74
75 Defined if the application is compiled for AVR32 processors.
76
77 \sa QSysInfo::buildCpuArchitecture()
78*/
79
80/*!
81 \macro Q_PROCESSOR_BLACKFIN
82 \relates <QtProcessorDetection>
83
84 Defined if the application is compiled for Blackfin processors.
85
86 \sa QSysInfo::buildCpuArchitecture()
87*/
88
89/*!
90 \macro Q_PROCESSOR_HPPA
91 \relates <QtProcessorDetection>
92
93 Defined if the application is compiled for PA-RISC processors.
94
95 \sa QSysInfo::buildCpuArchitecture()
96*/
97
98/*!
99 \macro Q_PROCESSOR_IA64
100 \relates <QtProcessorDetection>
101
102 Defined if the application is compiled for IA-64 processors. This includes
103 all Itanium and Itanium 2 processors.
104
105 \sa QSysInfo::buildCpuArchitecture()
106*/
107
108/*!
109 \macro Q_PROCESSOR_LOONGARCH
110 \relates <QtProcessorDetection>
111 \since 6.5
112
113 Defined if the application is compiled for LoongArch processors.
114
115 \sa QSysInfo::buildCpuArchitecture()
116*/
117
118/*!
119 \macro Q_PROCESSOR_LOONGARCH_32
120 \relates <QtProcessorDetection>
121 \since 6.5
122
123 Defined if the application is compiled for 32-bit LoongArch processors.
124 The \l Q_PROCESSOR_LOONGARCH macro is also defined when
125 Q_PROCESSOR_LOONGARCH_32 is defined.
126
127 \sa QSysInfo::buildCpuArchitecture()
128*/
129
130/*!
131 \macro Q_PROCESSOR_LOONGARCH_64
132 \relates <QtProcessorDetection>
133 \since 6.5
134
135 Defined if the application is compiled for 64-bit LoongArch processors.
136 The \l Q_PROCESSOR_LOONGARCH macro is also defined when
137 Q_PROCESSOR_LOONGARCH_64 is defined.
138
139 \sa QSysInfo::buildCpuArchitecture()
140*/
141
142/*!
143 \macro Q_PROCESSOR_M68K
144 \relates <QtProcessorDetection>
145
146 Defined if the application is compiled for Motorola 68000 processors.
147
148 \sa QSysInfo::buildCpuArchitecture()
149*/
150
151/*!
152 \macro Q_PROCESSOR_MIPS
153 \relates <QtProcessorDetection>
154
155 Defined if the application is compiled for MIPS processors. Qt currently
156 supports seven MIPS revisions: \l Q_PROCESSOR_MIPS_I, \l
157 Q_PROCESSOR_MIPS_II, \l Q_PROCESSOR_MIPS_III, \l Q_PROCESSOR_MIPS_IV, \l
158 Q_PROCESSOR_MIPS_V, \l Q_PROCESSOR_MIPS_32, and \l Q_PROCESSOR_MIPS_64.
159
160 \sa QSysInfo::buildCpuArchitecture()
161*/
162/*!
163 \macro Q_PROCESSOR_MIPS_I
164 \relates <QtProcessorDetection>
165
166 Defined if the application is compiled for MIPS-I processors. The \l
167 Q_PROCESSOR_MIPS macro is also defined when Q_PROCESSOR_MIPS_I is defined.
168
169 \sa QSysInfo::buildCpuArchitecture()
170*/
171/*!
172 \macro Q_PROCESSOR_MIPS_II
173 \relates <QtProcessorDetection>
174
175 Defined if the application is compiled for MIPS-II processors. The \l
176 Q_PROCESSOR_MIPS and \l Q_PROCESSOR_MIPS_I macros are also defined when
177 Q_PROCESSOR_MIPS_II is defined.
178
179 \sa QSysInfo::buildCpuArchitecture()
180*/
181/*!
182 \macro Q_PROCESSOR_MIPS_32
183 \relates <QtProcessorDetection>
184
185 Defined if the application is compiled for MIPS32 processors. The \l
186 Q_PROCESSOR_MIPS, \l Q_PROCESSOR_MIPS_I, and \l Q_PROCESSOR_MIPS_II macros
187 are also defined when Q_PROCESSOR_MIPS_32 is defined.
188
189 \sa QSysInfo::buildCpuArchitecture()
190*/
191/*!
192 \macro Q_PROCESSOR_MIPS_III
193 \relates <QtProcessorDetection>
194
195 Defined if the application is compiled for MIPS-III processors. The \l
196 Q_PROCESSOR_MIPS, \l Q_PROCESSOR_MIPS_I, and \l Q_PROCESSOR_MIPS_II macros
197 are also defined when Q_PROCESSOR_MIPS_III is defined.
198
199 \sa QSysInfo::buildCpuArchitecture()
200*/
201/*!
202 \macro Q_PROCESSOR_MIPS_IV
203 \relates <QtProcessorDetection>
204
205 Defined if the application is compiled for MIPS-IV processors. The \l
206 Q_PROCESSOR_MIPS, \l Q_PROCESSOR_MIPS_I, \l Q_PROCESSOR_MIPS_II, and \l
207 Q_PROCESSOR_MIPS_III macros are also defined when Q_PROCESSOR_MIPS_IV is
208 defined.
209
210 \sa QSysInfo::buildCpuArchitecture()
211*/
212/*!
213 \macro Q_PROCESSOR_MIPS_V
214 \relates <QtProcessorDetection>
215
216 Defined if the application is compiled for MIPS-V processors. The \l
217 Q_PROCESSOR_MIPS, \l Q_PROCESSOR_MIPS_I, \l Q_PROCESSOR_MIPS_II, \l
218 Q_PROCESSOR_MIPS_III, and \l Q_PROCESSOR_MIPS_IV macros are also defined
219 when Q_PROCESSOR_MIPS_V is defined.
220
221 \sa QSysInfo::buildCpuArchitecture()
222*/
223/*!
224 \macro Q_PROCESSOR_MIPS_64
225 \relates <QtProcessorDetection>
226
227 Defined if the application is compiled for MIPS64 processors. The \l
228 Q_PROCESSOR_MIPS, \l Q_PROCESSOR_MIPS_I, \l Q_PROCESSOR_MIPS_II, \l
229 Q_PROCESSOR_MIPS_III, \l Q_PROCESSOR_MIPS_IV, and \l Q_PROCESSOR_MIPS_V
230 macros are also defined when Q_PROCESSOR_MIPS_64 is defined.
231
232 \sa QSysInfo::buildCpuArchitecture()
233*/
234
235/*!
236 \macro Q_PROCESSOR_POWER
237 \relates <QtProcessorDetection>
238
239 Defined if the application is compiled for POWER processors. Qt currently
240 supports two Power variants: \l Q_PROCESSOR_POWER_32 and \l
241 Q_PROCESSOR_POWER_64.
242
243 \sa QSysInfo::buildCpuArchitecture()
244*/
245/*!
246 \macro Q_PROCESSOR_POWER_32
247 \relates <QtProcessorDetection>
248
249 Defined if the application is compiled for 32-bit Power processors. The \l
250 Q_PROCESSOR_POWER macro is also defined when Q_PROCESSOR_POWER_32 is
251 defined.
252
253 \sa QSysInfo::buildCpuArchitecture()
254*/
255/*!
256 \macro Q_PROCESSOR_POWER_64
257 \relates <QtProcessorDetection>
258
259 Defined if the application is compiled for 64-bit Power processors. The \l
260 Q_PROCESSOR_POWER macro is also defined when Q_PROCESSOR_POWER_64 is
261 defined.
262
263 \sa QSysInfo::buildCpuArchitecture()
264*/
265
266/*!
267 \macro Q_PROCESSOR_RISCV
268 \relates <QtProcessorDetection>
269 \since 5.13
270
271 Defined if the application is compiled for RISC-V processors. Qt currently
272 supports two RISC-V variants: \l Q_PROCESSOR_RISCV_32 and \l
273 Q_PROCESSOR_RISCV_64.
274
275 \sa QSysInfo::buildCpuArchitecture()
276*/
277
278/*!
279 \macro Q_PROCESSOR_RISCV_32
280 \relates <QtProcessorDetection>
281 \since 5.13
282
283 Defined if the application is compiled for 32-bit RISC-V processors. The \l
284 Q_PROCESSOR_RISCV macro is also defined when Q_PROCESSOR_RISCV_32 is
285 defined.
286
287 \sa QSysInfo::buildCpuArchitecture()
288*/
289
290/*!
291 \macro Q_PROCESSOR_RISCV_64
292 \relates <QtProcessorDetection>
293 \since 5.13
294
295 Defined if the application is compiled for 64-bit RISC-V processors. The \l
296 Q_PROCESSOR_RISCV macro is also defined when Q_PROCESSOR_RISCV_64 is
297 defined.
298
299 \sa QSysInfo::buildCpuArchitecture()
300*/
301
302/*!
303 \macro Q_PROCESSOR_S390
304 \relates <QtProcessorDetection>
305
306 Defined if the application is compiled for S/390 processors. Qt supports
307 one optional variant of S/390: Q_PROCESSOR_S390_X.
308
309 \sa QSysInfo::buildCpuArchitecture()
310*/
311/*!
312 \macro Q_PROCESSOR_S390_X
313 \relates <QtProcessorDetection>
314
315 Defined if the application is compiled for S/390x processors. The \l
316 Q_PROCESSOR_S390 macro is also defined when Q_PROCESSOR_S390_X is defined.
317
318 \sa QSysInfo::buildCpuArchitecture()
319*/
320
321/*!
322 \macro Q_PROCESSOR_SH
323 \relates <QtProcessorDetection>
324
325 Defined if the application is compiled for SuperH processors. Qt currently
326 supports one SuperH revision: \l Q_PROCESSOR_SH_4A.
327
328 \sa QSysInfo::buildCpuArchitecture()
329*/
330/*!
331 \macro Q_PROCESSOR_SH_4A
332 \relates <QtProcessorDetection>
333
334 Defined if the application is compiled for SuperH 4A processors. The \l
335 Q_PROCESSOR_SH macro is also defined when Q_PROCESSOR_SH_4A is defined.
336
337 \sa QSysInfo::buildCpuArchitecture()
338*/
339
340/*!
341 \macro Q_PROCESSOR_SPARC
342 \relates <QtProcessorDetection>
343
344 Defined if the application is compiled for SPARC processors. Qt currently
345 supports one optional SPARC revision: \l Q_PROCESSOR_SPARC_V9.
346
347 \sa QSysInfo::buildCpuArchitecture()
348*/
349/*!
350 \macro Q_PROCESSOR_SPARC_V9
351 \relates <QtProcessorDetection>
352
353 Defined if the application is compiled for SPARC V9 processors. The \l
354 Q_PROCESSOR_SPARC macro is also defined when Q_PROCESSOR_SPARC_V9 is
355 defined.
356
357 \sa QSysInfo::buildCpuArchitecture()
358*/
359
360/*!
361 \macro Q_PROCESSOR_X86
362 \relates <QtProcessorDetection>
363
364 Defined if the application is compiled for x86 processors. Qt currently
365 supports two x86 variants: \l Q_PROCESSOR_X86_32 and \l Q_PROCESSOR_X86_64.
366
367 \sa QSysInfo::buildCpuArchitecture()
368*/
369/*!
370 \macro Q_PROCESSOR_X86_32
371 \relates <QtProcessorDetection>
372
373 Defined if the application is compiled for 32-bit x86 processors. This
374 includes all i386, i486, i586, and i686 processors. The \l Q_PROCESSOR_X86
375 macro is also defined when Q_PROCESSOR_X86_32 is defined.
376
377 \sa QSysInfo::buildCpuArchitecture()
378*/
379/*!
380 \macro Q_PROCESSOR_X86_64
381 \relates <QtProcessorDetection>
382
383 Defined if the application is compiled for 64-bit x86 processors. This
384 includes all AMD64, Intel 64, and other x86_64/x64 processors. The \l
385 Q_PROCESSOR_X86 macro is also defined when Q_PROCESSOR_X86_64 is defined.
386
387 \sa QSysInfo::buildCpuArchitecture()
388*/
389
390/*!
391 \macro Q_BYTE_ORDER
392 \relates <QtProcessorDetection>
393
394 This macro can be used to determine the byte order your system
395 uses for storing data in memory. i.e., whether your system is
396 little-endian or big-endian. It is set by Qt to one of the macros
397 Q_LITTLE_ENDIAN or Q_BIG_ENDIAN. You normally won't need to worry
398 about endian-ness, but you might, for example if you need to know
399 which byte of an integer or UTF-16 character is stored in the
400 lowest address. Endian-ness is important in networking, where
401 computers with different values for Q_BYTE_ORDER must pass data
402 back and forth.
403
404 Use this macro as in the following examples.
405
406 \snippet code/src_corelib_global_qglobal.cpp 40
407
408 \sa Q_BIG_ENDIAN, Q_LITTLE_ENDIAN
409*/
410
411/*!
412 \macro Q_LITTLE_ENDIAN
413 \relates <QtProcessorDetection>
414
415 This macro represents a value you can compare to the macro
416 Q_BYTE_ORDER to determine the endian-ness of your system. In a
417 little-endian system, the least significant byte is stored at the
418 lowest address. The other bytes follow in increasing order of
419 significance.
420
421 \snippet code/src_corelib_global_qglobal.cpp 41
422
423 \sa Q_BYTE_ORDER, Q_BIG_ENDIAN
424*/
425
426/*!
427 \macro Q_BIG_ENDIAN
428 \relates <QtProcessorDetection>
429
430 This macro represents a value you can compare to the macro
431 Q_BYTE_ORDER to determine the endian-ness of your system. In a
432 big-endian system, the most significant byte is stored at the
433 lowest address. The other bytes follow in decreasing order of
434 significance.
435
436 \snippet code/src_corelib_global_qglobal.cpp 42
437
438 \sa Q_BYTE_ORDER, Q_LITTLE_ENDIAN
439*/
440
441/*!
442 \macro QT_POINTER_SIZE
443 \relates <QtProcessorDetection>
444
445 Expands to the size of a pointer in bytes (4 or 8). This is
446 equivalent to \c sizeof(void *) but can be used in a preprocessor
447 directive.
448*/