<QtProcessorDetection> - Architecture-specific Macro Definitions

The <QtProcessorDetection> header file includes various architecture-specific macros. More...

Header: #include <QtProcessorDetection>

Macros

Detailed Description

The <QtProcessorDetection> header file declares a range of macros (Q_PROCESSOR_*) that are defined if the application is compiled for specified processor architectures. For example, the Q_PROCESSOR_X86 macro is defined if the application is compiled for x86 processors.

The purpose of these macros is to enable programmers to add architecture-specific code to their application.

Macro Documentation

QT_POINTER_SIZE

Expands to the size of a pointer in bytes (4 or 8). This is equivalent to sizeof(void *) but can be used in a preprocessor directive.

Q_BIG_ENDIAN

This macro represents a value you can compare to the macro Q_BYTE_ORDER to determine the endian-ness of your system. In a big-endian system, the most significant byte is stored at the lowest address. The other bytes follow in decreasing order of significance.

 #if Q_BYTE_ORDER == Q_BIG_ENDIAN
 ...
 #endif

See also Q_BYTE_ORDER and Q_LITTLE_ENDIAN.

Q_BYTE_ORDER

This macro can be used to determine the byte order your system uses for storing data in memory. i.e., whether your system is little-endian or big-endian. It is set by Qt to one of the macros Q_LITTLE_ENDIAN or Q_BIG_ENDIAN. You normally won't need to worry about endian-ness, but you might, for example if you need to know which byte of an integer or UTF-16 character is stored in the lowest address. Endian-ness is important in networking, where computers with different values for Q_BYTE_ORDER must pass data back and forth.

Use this macro as in the following examples.

 #if Q_BYTE_ORDER == Q_BIG_ENDIAN
 ...
 #endif

 or

 #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
 ...
 #endif

See also Q_BIG_ENDIAN and Q_LITTLE_ENDIAN.

Q_LITTLE_ENDIAN

This macro represents a value you can compare to the macro Q_BYTE_ORDER to determine the endian-ness of your system. In a little-endian system, the least significant byte is stored at the lowest address. The other bytes follow in increasing order of significance.

 #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
 ...
 #endif

See also Q_BYTE_ORDER and Q_BIG_ENDIAN.

Q_PROCESSOR_X86

Defined if the application is compiled for x86 processors. Qt currently supports two x86 variants: Q_PROCESSOR_X86_32 and Q_PROCESSOR_X86_64.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_S390

Defined if the application is compiled for S/390 processors. Qt supports one optional variant of S/390: Q_PROCESSOR_S390_X.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_ALPHA

Defined if the application is compiled for Alpha processors.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_ARM

Defined if the application is compiled for ARM processors. Qt currently supports three optional ARM revisions: Q_PROCESSOR_ARM_V5, Q_PROCESSOR_ARM_V6, and Q_PROCESSOR_ARM_V7.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_ARM_V5

Defined if the application is compiled for ARMv5 processors. The Q_PROCESSOR_ARM macro is also defined when Q_PROCESSOR_ARM_V5 is defined.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_ARM_V6

Defined if the application is compiled for ARMv6 processors. The Q_PROCESSOR_ARM and Q_PROCESSOR_ARM_V5 macros are also defined when Q_PROCESSOR_ARM_V6 is defined.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_ARM_V7

Defined if the application is compiled for ARMv7 processors. The Q_PROCESSOR_ARM, Q_PROCESSOR_ARM_V5, and Q_PROCESSOR_ARM_V6 macros are also defined when Q_PROCESSOR_ARM_V7 is defined.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_AVR32

Defined if the application is compiled for AVR32 processors.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_BLACKFIN

Defined if the application is compiled for Blackfin processors.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_HPPA

Defined if the application is compiled for PA-RISC processors.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_IA64

Defined if the application is compiled for IA-64 processors. This includes all Itanium and Itanium 2 processors.

See also QSysInfo::buildCpuArchitecture().

[since 6.5] Q_PROCESSOR_LOONGARCH

Defined if the application is compiled for LoongArch processors.

This macro was introduced in Qt 6.5.

See also QSysInfo::buildCpuArchitecture().

[since 6.5] Q_PROCESSOR_LOONGARCH_32

Defined if the application is compiled for 32-bit LoongArch processors. The Q_PROCESSOR_LOONGARCH macro is also defined when Q_PROCESSOR_LOONGARCH_32 is defined.

This macro was introduced in Qt 6.5.

See also QSysInfo::buildCpuArchitecture().

[since 6.5] Q_PROCESSOR_LOONGARCH_64

Defined if the application is compiled for 64-bit LoongArch processors. The Q_PROCESSOR_LOONGARCH macro is also defined when Q_PROCESSOR_LOONGARCH_64 is defined.

This macro was introduced in Qt 6.5.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_M68K

Defined if the application is compiled for Motorola 68000 processors.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_MIPS

Defined if the application is compiled for MIPS processors. Qt currently supports seven MIPS revisions: Q_PROCESSOR_MIPS_I, Q_PROCESSOR_MIPS_II, Q_PROCESSOR_MIPS_III, Q_PROCESSOR_MIPS_IV, Q_PROCESSOR_MIPS_V, Q_PROCESSOR_MIPS_32, and Q_PROCESSOR_MIPS_64.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_MIPS_32

Defined if the application is compiled for MIPS32 processors. The Q_PROCESSOR_MIPS, Q_PROCESSOR_MIPS_I, and Q_PROCESSOR_MIPS_II macros are also defined when Q_PROCESSOR_MIPS_32 is defined.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_MIPS_64

Defined if the application is compiled for MIPS64 processors. The Q_PROCESSOR_MIPS, Q_PROCESSOR_MIPS_I, Q_PROCESSOR_MIPS_II, Q_PROCESSOR_MIPS_III, Q_PROCESSOR_MIPS_IV, and Q_PROCESSOR_MIPS_V macros are also defined when Q_PROCESSOR_MIPS_64 is defined.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_MIPS_I

Defined if the application is compiled for MIPS-I processors. The Q_PROCESSOR_MIPS macro is also defined when Q_PROCESSOR_MIPS_I is defined.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_MIPS_II

Defined if the application is compiled for MIPS-II processors. The Q_PROCESSOR_MIPS and Q_PROCESSOR_MIPS_I macros are also defined when Q_PROCESSOR_MIPS_II is defined.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_MIPS_III

Defined if the application is compiled for MIPS-III processors. The Q_PROCESSOR_MIPS, Q_PROCESSOR_MIPS_I, and Q_PROCESSOR_MIPS_II macros are also defined when Q_PROCESSOR_MIPS_III is defined.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_MIPS_IV

Defined if the application is compiled for MIPS-IV processors. The Q_PROCESSOR_MIPS, Q_PROCESSOR_MIPS_I, Q_PROCESSOR_MIPS_II, and Q_PROCESSOR_MIPS_III macros are also defined when Q_PROCESSOR_MIPS_IV is defined.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_MIPS_V

Defined if the application is compiled for MIPS-V processors. The Q_PROCESSOR_MIPS, Q_PROCESSOR_MIPS_I, Q_PROCESSOR_MIPS_II, Q_PROCESSOR_MIPS_III, and Q_PROCESSOR_MIPS_IV macros are also defined when Q_PROCESSOR_MIPS_V is defined.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_POWER

Defined if the application is compiled for POWER processors. Qt currently supports two Power variants: Q_PROCESSOR_POWER_32 and Q_PROCESSOR_POWER_64.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_POWER_32

Defined if the application is compiled for 32-bit Power processors. The Q_PROCESSOR_POWER macro is also defined when Q_PROCESSOR_POWER_32 is defined.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_POWER_64

Defined if the application is compiled for 64-bit Power processors. The Q_PROCESSOR_POWER macro is also defined when Q_PROCESSOR_POWER_64 is defined.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_RISCV

Defined if the application is compiled for RISC-V processors. Qt currently supports two RISC-V variants: Q_PROCESSOR_RISCV_32 and Q_PROCESSOR_RISCV_64.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_RISCV_32

Defined if the application is compiled for 32-bit RISC-V processors. The Q_PROCESSOR_RISCV macro is also defined when Q_PROCESSOR_RISCV_32 is defined.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_RISCV_64

Defined if the application is compiled for 64-bit RISC-V processors. The Q_PROCESSOR_RISCV macro is also defined when Q_PROCESSOR_RISCV_64 is defined.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_S390_X

Defined if the application is compiled for S/390x processors. The Q_PROCESSOR_S390 macro is also defined when Q_PROCESSOR_S390_X is defined.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_SH

Defined if the application is compiled for SuperH processors. Qt currently supports one SuperH revision: Q_PROCESSOR_SH_4A.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_SH_4A

Defined if the application is compiled for SuperH 4A processors. The Q_PROCESSOR_SH macro is also defined when Q_PROCESSOR_SH_4A is defined.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_SPARC

Defined if the application is compiled for SPARC processors. Qt currently supports one optional SPARC revision: Q_PROCESSOR_SPARC_V9.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_SPARC_V9

Defined if the application is compiled for SPARC V9 processors. The Q_PROCESSOR_SPARC macro is also defined when Q_PROCESSOR_SPARC_V9 is defined.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_X86_32

Defined if the application is compiled for 32-bit x86 processors. This includes all i386, i486, i586, and i686 processors. The Q_PROCESSOR_X86 macro is also defined when Q_PROCESSOR_X86_32 is defined.

See also QSysInfo::buildCpuArchitecture().

Q_PROCESSOR_X86_64

Defined if the application is compiled for 64-bit x86 processors. This includes all AMD64, Intel 64, and other x86_64/x64 processors. The Q_PROCESSOR_X86 macro is also defined when Q_PROCESSOR_X86_64 is defined.

See also QSysInfo::buildCpuArchitecture().