spy v1.1.0
Julienne Aisner
 
Loading...
Searching...
No Matches

◆ architecture

constexpr arch_type spy::architecture
inlineconstexpr

Architecture reporting value.

The spy::architecture object can be compared to any other architecture related value to verify if the code being compiled is compiled for a given CPU architecture.

Additionally, any of the architecture related value are convertible to bool. They evaluates to true if they matches the correct architecture currently targeted.

Supported Value

Name Architecture
spy::amd64 Intel X86-64 and similar architectures.
spy::arm ARM.
spy::ppc PowerPC.
spy::riscv RISC-V.
spy::wasm WASM pseudo-architecture.
spy::x86 Intel X86.

Example

#include <spy/spy.hpp>
#include <iostream>
int main()
{
// Comparisons
if constexpr( spy::architecture == spy::x86_ ) std::cout << "This code is compiled for X86.\n";
else if constexpr( spy::architecture == spy::amd64_ ) std::cout << "This code is compiled for X86-64.\n";
else if constexpr( spy::architecture == spy::ppc_ ) std::cout << "This code is compiled for PowerPC.\n";
else if constexpr( spy::architecture == spy::arm_ ) std::cout << "This code is compiled for ARM.\n";
else if constexpr( spy::architecture == spy::riscv_ ) std::cout << "This code is compiled for RISC-V.\n";
// Direct test
if constexpr( spy::x86_ ) std::cout << "This code is compiled for X86.\n";
else if constexpr( spy::amd64_ ) std::cout << "This code is compiled for X86-64.\n";
else if constexpr( spy::ppc_ ) std::cout << "This code is compiled for PowerPC.\n";
else if constexpr( spy::arm_ ) std::cout << "This code is compiled for ARM.\n";
else if constexpr( spy::riscv_ ) std::cout << "This code is compiled for RISC-V.\n";
}
constexpr arch_type architecture
Architecture reporting value.
Definition: arch.hpp:100