native 0.0.1
Vectors, masks and wide register packs for C++26
Loading...
Searching...
No Matches
config.h
1#pragma once
2// Host architecture controls declaration availability. Function target scopes
3// select instruction requirements independently of the producer's minimum ISA.
4#ifdef __cplusplus
5#if defined(__x86_64__) || defined(_M_X64)
6#define NATIVE_HOST_X86 1
7#else
8#define NATIVE_HOST_X86 0
9#endif
10#if defined(__aarch64__) || defined(_M_ARM64)
11#define NATIVE_HOST_NEON 1
12#else
13#define NATIVE_HOST_NEON 0
14#endif
15
16#if defined(__wasm__)
17#define NATIVE_HOST_WASM 1
18#else
19#define NATIVE_HOST_WASM 0
20#endif
21
22namespace native {
24 enum class architecture { x86, arm, wasm, unknown };
26 inline constexpr architecture x86=architecture::x86;
28 inline constexpr architecture arm=architecture::arm;
30 inline constexpr architecture wasm=architecture::wasm;
32 inline constexpr architecture target_arch=
33#if defined(__arm__) || defined(__aarch64__) || defined(_M_ARM) || defined(_M_ARM64) || defined(_M_ARM64EC)
34 arm;
35#elif defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64)
36 x86;
37#elif defined(__wasm__) || defined(__wasm32__) || defined(__wasm64__)
38 wasm;
39#else
40 architecture::unknown;
41#endif
42}
43#else
44#ifndef NATIVE_NAMESPACE
45#define NATIVE_NAMESPACE native
46#endif
47#endif
48// SPDX-FileCopyrightText: 2026 Edward Kmett <ekmett@gmail.com>
49// SPDX-License-Identifier: BSD-2-Clause OR Apache-2.0
Architecture-tagged vectors, register packs and supporting value types. Native arithmetic follows its...
constexpr architecture arm
Select ARM feature metadata independently of the compilation target.
Definition config.h:28
constexpr architecture x86
Select x86 feature metadata independently of the compilation target.
Definition config.h:26
architecture
Instruction-set families; an ISA value belongs to exactly one family.
Definition config.h:24
constexpr architecture wasm
Select WebAssembly feature metadata independently of the compilation target.
Definition config.h:30
@ unknown
Any other vendor string.
constexpr architecture target_arch
The compiler target's family; no optional instruction support is implied.
Definition config.h:32