1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
5 \headerfile <QtProcessorDetection>
7 \title Architecture-specific Macro Definitions
10 \brief The <QtProcessorDetection> header file includes various
11 architecture-specific macros.
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.
18 The purpose of these macros is to enable programmers to add
19 architecture-specific code to their application.
23 \macro Q_PROCESSOR_ALPHA
24 \relates <QtProcessorDetection>
26 Defined if the application is compiled for Alpha processors.
28 \sa QSysInfo::buildCpuArchitecture()
32 \macro Q_PROCESSOR_ARM
33 \relates <QtProcessorDetection>
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.
39 \sa QSysInfo::buildCpuArchitecture()
42 \macro Q_PROCESSOR_ARM_V5
43 \relates <QtProcessorDetection>
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.
48 \sa QSysInfo::buildCpuArchitecture()
51 \macro Q_PROCESSOR_ARM_V6
52 \relates <QtProcessorDetection>
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.
58 \sa QSysInfo::buildCpuArchitecture()
61 \macro Q_PROCESSOR_ARM_V7
62 \relates <QtProcessorDetection>
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.
68 \sa QSysInfo::buildCpuArchitecture()
72 \macro Q_PROCESSOR_AVR32
73 \relates <QtProcessorDetection>
75 Defined if the application is compiled for AVR32 processors.
77 \sa QSysInfo::buildCpuArchitecture()
81 \macro Q_PROCESSOR_BLACKFIN
82 \relates <QtProcessorDetection>
84 Defined if the application is compiled for Blackfin processors.
86 \sa QSysInfo::buildCpuArchitecture()
90 \macro Q_PROCESSOR_HPPA
91 \relates <QtProcessorDetection>
93 Defined if the application is compiled for PA-RISC processors.
95 \sa QSysInfo::buildCpuArchitecture()
99 \macro Q_PROCESSOR_IA64
100 \relates <QtProcessorDetection>
102 Defined if the application is compiled for IA-64 processors. This includes
103 all Itanium and Itanium 2 processors.
105 \sa QSysInfo::buildCpuArchitecture()
109 \macro Q_PROCESSOR_LOONGARCH
110 \relates <QtProcessorDetection>
113 Defined if the application is compiled for LoongArch processors.
115 \sa QSysInfo::buildCpuArchitecture()
119 \macro Q_PROCESSOR_LOONGARCH_32
120 \relates <QtProcessorDetection>
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.
127 \sa QSysInfo::buildCpuArchitecture()
131 \macro Q_PROCESSOR_LOONGARCH_64
132 \relates <QtProcessorDetection>
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.
139 \sa QSysInfo::buildCpuArchitecture()
143 \macro Q_PROCESSOR_M68K
144 \relates <QtProcessorDetection>
146 Defined if the application is compiled for Motorola 68000 processors.
148 \sa QSysInfo::buildCpuArchitecture()
152 \macro Q_PROCESSOR_MIPS
153 \relates <QtProcessorDetection>
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.
160 \sa QSysInfo::buildCpuArchitecture()
163 \macro Q_PROCESSOR_MIPS_I
164 \relates <QtProcessorDetection>
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.
169 \sa QSysInfo::buildCpuArchitecture()
172 \macro Q_PROCESSOR_MIPS_II
173 \relates <QtProcessorDetection>
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.
179 \sa QSysInfo::buildCpuArchitecture()
182 \macro Q_PROCESSOR_MIPS_32
183 \relates <QtProcessorDetection>
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.
189 \sa QSysInfo::buildCpuArchitecture()
192 \macro Q_PROCESSOR_MIPS_III
193 \relates <QtProcessorDetection>
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.
199 \sa QSysInfo::buildCpuArchitecture()
202 \macro Q_PROCESSOR_MIPS_IV
203 \relates <QtProcessorDetection>
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
210 \sa QSysInfo::buildCpuArchitecture()
213 \macro Q_PROCESSOR_MIPS_V
214 \relates <QtProcessorDetection>
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.
221 \sa QSysInfo::buildCpuArchitecture()
224 \macro Q_PROCESSOR_MIPS_64
225 \relates <QtProcessorDetection>
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.
232 \sa QSysInfo::buildCpuArchitecture()
236 \macro Q_PROCESSOR_POWER
237 \relates <QtProcessorDetection>
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.
243 \sa QSysInfo::buildCpuArchitecture()
246 \macro Q_PROCESSOR_POWER_32
247 \relates <QtProcessorDetection>
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
253 \sa QSysInfo::buildCpuArchitecture()
256 \macro Q_PROCESSOR_POWER_64
257 \relates <QtProcessorDetection>
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
263 \sa QSysInfo::buildCpuArchitecture()
267 \macro Q_PROCESSOR_RISCV
268 \relates <QtProcessorDetection>
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.
275 \sa QSysInfo::buildCpuArchitecture()
279 \macro Q_PROCESSOR_RISCV_32
280 \relates <QtProcessorDetection>
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
287 \sa QSysInfo::buildCpuArchitecture()
291 \macro Q_PROCESSOR_RISCV_64
292 \relates <QtProcessorDetection>
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
299 \sa QSysInfo::buildCpuArchitecture()
303 \macro Q_PROCESSOR_S390
304 \relates <QtProcessorDetection>
306 Defined if the application is compiled for S/390 processors. Qt supports
307 one optional variant of S/390: Q_PROCESSOR_S390_X.
309 \sa QSysInfo::buildCpuArchitecture()
312 \macro Q_PROCESSOR_S390_X
313 \relates <QtProcessorDetection>
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.
318 \sa QSysInfo::buildCpuArchitecture()
322 \macro Q_PROCESSOR_SH
323 \relates <QtProcessorDetection>
325 Defined if the application is compiled for SuperH processors. Qt currently
326 supports one SuperH revision: \l Q_PROCESSOR_SH_4A.
328 \sa QSysInfo::buildCpuArchitecture()
331 \macro Q_PROCESSOR_SH_4A
332 \relates <QtProcessorDetection>
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.
337 \sa QSysInfo::buildCpuArchitecture()
341 \macro Q_PROCESSOR_SPARC
342 \relates <QtProcessorDetection>
344 Defined if the application is compiled for SPARC processors. Qt currently
345 supports one optional SPARC revision: \l Q_PROCESSOR_SPARC_V9.
347 \sa QSysInfo::buildCpuArchitecture()
350 \macro Q_PROCESSOR_SPARC_V9
351 \relates <QtProcessorDetection>
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
357 \sa QSysInfo::buildCpuArchitecture()
361 \macro Q_PROCESSOR_X86
362 \relates <QtProcessorDetection>
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.
367 \sa QSysInfo::buildCpuArchitecture()
370 \macro Q_PROCESSOR_X86_32
371 \relates <QtProcessorDetection>
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.
377 \sa QSysInfo::buildCpuArchitecture()
380 \macro Q_PROCESSOR_X86_64
381 \relates <QtProcessorDetection>
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.
387 \sa QSysInfo::buildCpuArchitecture()
392 \relates <QtProcessorDetection>
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
404 Use this macro as in the following examples.
406 \snippet code/src_corelib_global_qglobal.cpp 40
408 \sa Q_BIG_ENDIAN, Q_LITTLE_ENDIAN
412 \macro Q_LITTLE_ENDIAN
413 \relates <QtProcessorDetection>
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
421 \snippet code/src_corelib_global_qglobal.cpp 41
423 \sa Q_BYTE_ORDER, Q_BIG_ENDIAN
428 \relates <QtProcessorDetection>
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
436 \snippet code/src_corelib_global_qglobal.cpp 42
438 \sa Q_BYTE_ORDER, Q_LITTLE_ENDIAN
442 \macro QT_POINTER_SIZE
443 \relates <QtProcessorDetection>
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