OGLplus
(0.59.0)
a C++ wrapper for rendering APIs
eagine
vect
abs.hpp
Go to the documentation of this file.
1
#ifndef EAGINE_VECT_ABS_HPP
9
#define EAGINE_VECT_ABS_HPP
10
11
#include "
data.hpp
"
12
#include <cmath>
13
14
namespace
eagine::vect {
15
16
template
<
typename
T,
int
N,
bool
V>
17
struct
abs {
18
// TODO: SIMD version?
19
20
static
auto
apply(data_t<T, N, V> v) noexcept -> data_t<T, N, V> {
21
for
(
int
i = 0; i < N; ++i) {
22
v[i] = v[i] < 0 ? -v[i] : v[i];
23
}
24
return
v;
25
}
26
};
27
28
}
// namespace eagine::vect
29
30
#endif // EAGINE_VECT_ABS_HPP
data.hpp
Copyright © 2015-2021
Matúš Chochlík
.
<
chochlik -at -gmail.com
>
Documentation generated on Tue Apr 13 2021 by
Doxygen
(version 1.8.17).