Dune Core Modules (2.8.0)

standard.hh
Go to the documentation of this file.
1#ifndef DUNE_COMMON_SIMD_STANDARD_HH
2#define DUNE_COMMON_SIMD_STANDARD_HH
3
18#include <cstddef>
19#include <type_traits>
20#include <utility>
21
22#include <dune/common/indices.hh>
25
43namespace Dune {
44 namespace Simd {
45
46 namespace Overloads {
47
54
57 template<class V, class>
58 struct ScalarType { using type = V; };
59
61
64 template<class S, class, class>
65 struct RebindType { using type = S; };
66
68
71 template<class, class>
72 struct LaneCount : public index_constant<1> { };
73
75
84 template<class V>
85 V lane(ADLTag<2>, std::size_t, V v)
86 {
87 return v;
88 }
89
90 template<class V>
91 V &lane(ADLTag<3>, std::size_t, V &v)
92 {
93 return v;
94 }
95
96 // No Simd::cond() implementation, the overload for bool masks in the
97 // interface is sufficient
98
100 inline bool anyTrue(ADLTag<2>, bool mask) { return mask; }
101
103 inline bool allTrue(ADLTag<2>, bool mask) { return mask; }
104
106 inline bool anyFalse(ADLTag<2>, bool mask) { return !mask; }
107
109 inline bool allFalse(ADLTag<2>, bool mask) { return !mask; }
110
112
113 } // namespace Overloads
114 } // namespace Simd
115} // namespace Dune
116
117#endif // DUNE_COMMON_SIMD_STANDARD_HH
Basic definitions for SIMD Implementations.
Default implementations for SIMD Implementations.
std::integral_constant< std::size_t, i > index_constant
An index constant with value i.
Definition: indices.hh:28
Mask< V > mask(ADLTag< 0, std::is_same< V, Mask< V > >::value >, const V &v)
implements Simd::mask()
Definition: defaults.hh:151
bool allFalse(ADLTag< 0 >, const Mask &mask)
implements Simd::allFalse()
Definition: defaults.hh:122
bool allTrue(ADLTag< 0 >, const Mask &mask)
implements Simd::allTrue()
Definition: defaults.hh:102
bool anyFalse(ADLTag< 0 >, const Mask &mask)
implements Simd::anyFalse()
Definition: defaults.hh:112
Dune namespace.
Definition: alignedallocator.hh:11
Tag used to force late-binding lookup in Dune::Simd::Overloads.
Definition: base.hh:180
should be derived from a Dune::index_constant
Definition: standard.hh:72
should have a member type type
Definition: standard.hh:65
should have a member type type
Definition: standard.hh:58
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 12, 23:30, 2024)