|
ATLAS Offline Software
|
Go to the documentation of this file.
16 #ifndef CXXUTILS_VEC_FB_H
17 #define CXXUTILS_VEC_FB_H
19 #include <initializer_list>
20 #include <type_traits>
24 #include "boost/integer.hpp"
29 template<
typename T,
size_t N>
32 static_assert(std::is_arithmetic_v<T>,
"Element type is not arithmetic");
33 static_assert(
N > 0 && (
N & (
N - 1)) == 0,
"Size not a power or 2");
52 template <
typename T,
size_t N>
53 using ivec =
vec_fb<
typename boost::int_t<
sizeof(T) * 8>::exact,
N>;
64 template<typename T, size_t N> \
65 inline vec_fb<T, N> operator op(const vec_fb<T, N>& a, \
66 const vec_fb<T, N>& b) \
69 for (size_t i = 0; i < N; ++i) \
70 c.m_arr[i] = a.m_arr[i] op b.m_arr[i]; \
73 template<typename T, size_t N, typename U> \
74 inline vec_fb<T, N> operator op(const vec_fb<T, N>& a, U b) \
77 for (size_t i = 0; i < N; ++i) \
78 c.m_arr[i] = a.m_arr[i] op b; \
81 template<typename T, size_t N, typename U> \
82 inline vec_fb<T, N> operator op(U a, const vec_fb<T, N>& b) \
85 for (size_t i = 0; i < N; ++i) \
86 c.m_arr[i] = a op b.m_arr[i]; \
89 template<typename T, size_t N> \
90 inline vec_fb<T, N>& operator op##=(vec_fb<T, N>& a, const vec_fb<T, N>& b) \
92 for (size_t i = 0; i < N; ++i) \
93 a.m_arr[i] op## = b.m_arr[i]; \
96 template<typename T, size_t N, typename U> \
97 inline vec_fb<T, N>& operator op##=(vec_fb<T, N>& a, U b) \
99 for (size_t i = 0; i < N; ++i) \
100 a.m_arr[i] op## = b; \
120 template<typename T, size_t N> \
121 inline vec_fb<T, N> operator op(const vec_fb<T, N>& a) \
124 for (size_t i = 0; i < N; ++i) \
125 c.m_arr[i] = op a.m_arr[i]; \
137 template<typename T, size_t N> \
138 inline ivec<T, N> operator op(const vec_fb<T, N>& a, const vec_fb<T, N>& b) \
141 for (size_t i = 0; i < N; ++i) \
142 c.m_arr[i] = a.m_arr[i] op b.m_arr[i]; \
156 template<
typename T,
size_t N>
161 for (
size_t i = 0;
i <
N; ++
i)
162 c.m_arr[
i] =
a.m_arr[
i] == 0;
167 template<
typename T,
size_t N>
172 for (
size_t i = 0;
i <
N; ++
i)
173 c.m_arr[
i] = (
a.m_arr[
i] != 0) & (
b.m_arr[
i] != 0);
178 template<
typename T,
size_t N,
class U>
183 for (
size_t i = 0;
i <
N; ++
i)
184 c.m_arr[
i] =
a ?
b.m_arr[
i] != 0 : 0;
189 template<
typename T,
size_t N,
class U>
194 for (
size_t i = 0;
i <
N; ++
i)
195 c.m_arr[
i] = (
a.m_arr[
i] != 0) & (
b ? -1 : 0);
200 template<
typename T,
size_t N>
205 for (
size_t i = 0;
i <
N; ++
i)
206 c.m_arr[
i] = (
a.m_arr[
i] != 0) | (
b.m_arr[
i] != 0);
212 #endif // CXXUTILS_VEC_FB_H
vec_fb(const vec_fb &)=default
ivec< T, N > operator&&(const vec_fb< T, N > &a, const vec_fb< T, N > &b)
V1 && V2.
ivec< T, N > operator!(const vec_fb< T, N > &a)
Negation.
vec_fb & operator=(const vec_fb &)=default
ivec< T, N > operator||(const vec_fb< T, N > &a, const vec_fb< T, N > &b)
V1 || V2.
void fill(H5::Group &out_file, size_t iterations)
def init(v_theApp, v_rootStream=None)
T operator[](size_t n) const
vec_fb(std::initializer_list< T > init)