OGLplus  (0.59.0) a C++ wrapper for rendering APIs

sdiv.hpp
Go to the documentation of this file.
1 #ifndef EAGINE_VECT_SDIV_HPP
9 #define EAGINE_VECT_SDIV_HPP
10 
11 #include "data.hpp"
12 
13 namespace eagine::vect {
14 
15 template <typename T, int N, bool V>
16 struct sdiv {
17  using _dpT = data_param_t<T, N, V>;
18 
19  static constexpr auto apply(_dpT a, _dpT b) noexcept -> data_t<T, N, V> {
20  return a / b;
21  }
22 };
23 
24 #if EAGINE_USE_SIMD
25 #if defined(__GNUC__) || defined(__clang__)
26 
27 template <typename T, bool V>
28 struct sdiv<T, 3, V> {
29  using _dT = data_t<T, 3, V>;
30  using _dpT = data_param_t<T, 3, V>;
31 
32  static constexpr auto _hlp(_dpT a, _dpT b, std::true_type) noexcept -> _dT {
33  return a / _dT{b[0], b[1], b[2], T(1)};
34  }
35 
36  static constexpr auto _hlp(_dpT a, _dpT b, std::false_type) noexcept
37  -> _dT {
38  return a / b;
39  }
40 
41  static constexpr auto apply(_dpT a, _dpT b) noexcept -> _dT {
42  return _hlp(a, b, has_vect_data<T, 3, V>());
43  }
44 };
45 
46 #endif
47 #endif
48 
49 } // namespace eagine::vect
50 
51 #endif // EAGINE_VECT_SDIV_HPP

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).