vir-simd 0.4.189
Parallelism TS 2 extensions and simd fallback implementation
Loading...
Searching...
No Matches
simd_version.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: LGPL-3.0-or-later */
2/* Copyright © 2024–2025 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
3 * Matthias Kretz <m.kretz@gsi.de>
4 */
5
6#ifndef VIR_SIMD_VERSION_H_
7#define VIR_SIMD_VERSION_H_
8
12
13#if __cpp_impl_three_way_comparison >= 201907L and __cpp_lib_three_way_comparison >= 201907L
14#define VIR_HAVE_SPACESHIP 1
15#include <compare>
16#else
17#define VIR_HAVE_SPACESHIP 0
18#endif
19
28#define VIR_SIMD_VERSION 0x0'04'bd
29
33#define VIR_SIMD_VERSION_MAJOR (VIR_SIMD_VERSION / 0x10000)
34
38#define VIR_SIMD_VERSION_MINOR ((VIR_SIMD_VERSION % 0x10000) / 0x100)
39
43#define VIR_SIMD_VERSION_PATCHLEVEL (VIR_SIMD_VERSION % 0x100)
44
52namespace vir
53{
56 {
58 int major;
60 int minor;
63
65 friend constexpr bool
67 { return a.major == b.major and a.minor == b.minor and a.patchlevel == b.patchlevel; }
68
70 friend constexpr bool
72 { return not (a == b); }
73
74#if VIR_HAVE_SPACESHIP
76 friend constexpr std::strong_ordering
78#else
79 friend constexpr bool
80 operator<(simd_version_t a, simd_version_t b)
81 {
82 return a.major < b.major
83 or (a.major == b.major and a.minor < b.minor)
84 or (a.major == b.major and a.minor == b.minor and a.patchlevel < b.patchlevel);
85 }
86
87 friend constexpr bool
88 operator<=(simd_version_t a, simd_version_t b)
89 {
90 return a.major < b.major
91 or (a.major == b.major and a.minor < b.minor)
92 or (a.major == b.major and a.minor == b.minor and a.patchlevel <= b.patchlevel);
93 }
94
95 friend constexpr bool
96 operator>(simd_version_t a, simd_version_t b)
97 { return b < a; }
98
99 friend constexpr bool
100 operator>=(simd_version_t a, simd_version_t b)
101 { return b <= a; }
102#endif
103 };
104
113 inline constexpr simd_version_t
115}
116
117#endif // VIR_SIMD_VERSION_H_
This namespace collects libraries and tools authored by Matthias Kretz.
Definition constexpr_wrapper.h:21
constexpr simd_version_t simd_version
The current version.
Definition simd_version.h:114
#define VIR_SIMD_VERSION_MINOR
The minor version number component.
Definition simd_version.h:38
#define VIR_SIMD_VERSION_MAJOR
The major version number component.
Definition simd_version.h:33
#define VIR_SIMD_VERSION_PATCHLEVEL
The patchlevel version number component.
Definition simd_version.h:43
Represents the vir-simd version of major, minor, and patchlevel components.
Definition simd_version.h:56
friend constexpr std::strong_ordering operator<=>(simd_version_t, simd_version_t)=default
Relational operators.
int major
An increment of the major version number implies a breaking change.
Definition simd_version.h:58
friend constexpr bool operator==(simd_version_t a, simd_version_t b)
Check for equality.
Definition simd_version.h:66
friend constexpr bool operator!=(simd_version_t a, simd_version_t b)
Check for inequality.
Definition simd_version.h:71
int minor
An increment of the minor version number implies new features without breaking changes.
Definition simd_version.h:60
int patchlevel
An increment of the patchlevel is used for bug fixes. Odd numbers indicate a development version.
Definition simd_version.h:62