class
#include <Corrade/Cpu.h>
Features Feature set.
Provides storage and comparison as well as runtime detection of CPU instruction set. Provides an interface similar to an Containers::
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
template<class T, class = decltype(TypeTraits<T>::Index)>
Corrade:: Cpu:: Features:: Features(T) constexpr noexcept
Construct from a tag.
Corrade:: Cpu:: Features:: operator bool() const explicit constexpr
Boolean conversion.
Returns true
if at least one feature apart from Scalar is present, false
otherwise.
Corrade:: Cpu:: Features:: operator unsigned int() const explicit constexpr
Integer representation.
For testing purposes. Cpu::0
, values corresponding to other feature tags are unspecified.
bool Corrade:: Cpu:: Features:: operator>=(Features other) const constexpr
Whether other
is a subset of this ( )
Equivalent to (a & other) == other
.
bool Corrade:: 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::
Cpu::Features a = Cpu::Avx2; Cpu::Features b = Cpu::features<Cpu::Avx2T>();
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 CORRADE_
On ARM, returns a combination of Neon, NeonFma and NeonFp16 based on what all CORRADE_
On WebAssembly, returns Simd128 based on whether the CORRADE_
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 U, class = decltype(TypeTraits<T>::Index), class = decltype(TypeTraits<U>::Index)>
bool operator==(T,
U) constexpr
Equality comparison of two tags.
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 U, class = decltype(TypeTraits<T>::Index), class = decltype(TypeTraits<U>::Index)>
bool operator!=(T,
U) constexpr
Non-equality comparison of two tags.
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>
Features operator~(T a) constexpr
Feature set complement.
Same as Features::
Utility:: Debug& operator<<(Utility:: Debug& debug,
Features value)
Debug output operator.
template<class T, class = decltype(TypeTraits<T>::Index)>
Utility:: Debug& operator<<(Utility:: Debug& debug,
T value)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.