class
#include <Cpu.h>
Features Feature set.
Provides storage and comparison as well as runtime detection of CPU instruction set. See the Cpu namespace for an overview and usage examples.
Constructors, destructors, conversion operators
- Features() explicit constexpr noexcept
- Default constructor.
-
template<class T, class = decltype(TypeTraits<T>::Index)>Features(T) constexpr noexcept
- Construct from a tag.
- operator bool() const explicit constexpr
- Boolean conversion.
- operator unsigned int() const explicit constexpr
- Integer representation.
Public functions
- auto operator==(Features other) const -> bool constexpr
- Equality comparison.
- auto operator!=(Features other) const -> bool constexpr
- Non-equality comparison.
- auto operator>=(Features other) const -> bool constexpr
- Whether
other
is a subset of this ( ) - auto operator<=(Features other) const -> bool constexpr
- Whether
other
is a superset of this ( ) - auto operator|(Features other) const -> Features constexpr
- Union of two feature sets.
- auto operator|=(Features other) -> Features&
- Union two feature sets and assign.
- auto operator&(Features other) const -> Features constexpr
- Intersection of two feature sets.
- auto operator&=(Features other) -> Features&
- Intersect two feature sets and assign.
- auto operator^(Features other) const -> Features constexpr
- XOR of two feature sets.
- auto operator^=(Features other) -> Features&
- XOR two feature sets and assign.
- auto operator~() const -> Features constexpr
- Feature set complement.
Friends
-
template<class>auto features() -> Features constexpr
- Feature set for a tag type.
- auto compiledFeatures() -> Features constexpr
- CPU instruction sets enabled at compile time.
Function documentation
Death:: Cpu:: Features:: operator bool() const explicit constexpr
Boolean conversion.
Returns true
if at least one feature apart from Scalar is present, false
otherwise.
Death:: Cpu:: Features:: operator unsigned int() const explicit constexpr
Integer representation.
For testing purposes. Cpu::0
, values corresponding to other feature tags are unspecified.
bool Death:: Cpu:: Features:: operator>=(Features other) const constexpr
Whether other
is a subset of this ( )
Equivalent to (a & other) == other
.
bool Death:: Cpu:: Features:: operator<=(Features other) const constexpr
Whether other
is a superset of this ( )
Equivalent to (a & other) == a
.
template<class>
Features features() constexpr
Feature set for a tag type.
Returns Features with a tag corresponding to tag type T
, avoiding a need to form the tag value in order to pass it to Features::
Features compiledFeatures() constexpr
CPU instruction sets enabled at compile time.
On x86 returns a combination of Sse2, Sse3, Ssse3, Sse41, Sse42, Popcnt, Lzcnt, Bmi1, Bmi2, Avx, AvxF16c, AvxFma, Avx2 and Avx512f based on what all DEATH_
On ARM, returns a combination of Neon, NeonFma and NeonFp16 based on what all DEATH_
On WebAssembly, returns Simd128 based on whether the DEATH_
On other platforms or if no known CPU instruction set is enabled, the returned value is equal to Scalar, which in turn is equivalent to empty (or default-constructed) Features.
template<class T, class = decltype(TypeTraits<T>::Index)>
bool operator==(T a,
Features b) constexpr
Equality comparison of a tag and a feature set.
Same as Features::
template<class T, class = decltype(TypeTraits<T>::Index)>
bool operator!=(T a,
Features b) constexpr
Non-equality comparison of a tag and a feature set.
Same as Features::
template<class T, class = decltype(TypeTraits<T>::Index)>
bool operator>=(T a,
Features b) constexpr
Whether a
is a superset of b
( )
Same as Features::
template<class T, class = decltype(TypeTraits<T>::Index)>
bool operator<=(T a,
Features b) constexpr
Whether a
is a subset of b
( )
Same as Features::
template<class T, class = decltype(TypeTraits<T>::Index)>
Features operator|(T a,
Features b) constexpr
Union of two feature sets.
Same as Features::
template<class T, class = decltype(TypeTraits<T>::Index)>
Features operator&(T a,
Features b) constexpr
Intersection of two feature sets.
Same as Features::
template<class T, class = decltype(TypeTraits<T>::Index)>
Features operator^(T a,
Features b) constexpr
XOR of two feature sets.
Same as Features::
template<class T>
Implementation::Tags<~TypeTraits<T>::Index> operator~(T) constexpr
Feature set complement.
Same as Features::