]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/qvm/quat.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / qvm / quat.hpp
1 #ifndef BOOST_QVM_QUAT_HPP_INCLUDED
2 #define BOOST_QVM_QUAT_HPP_INCLUDED
3
4 // Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc.
5
6 // Distributed under the Boost Software License, Version 1.0. (See accompanying
7 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8
9 #include <boost/qvm/detail/quat_assign.hpp>
10 #include <boost/qvm/assert.hpp>
11 #include <boost/qvm/static_assert.hpp>
12
13 namespace boost { namespace qvm {
14
15 template <class T>
16 struct
17 quat
18 {
19 T a[4];
20 template <class R>
21 operator R() const
22 {
23 R r;
24 assign(r,*this);
25 return r;
26 }
27 };
28
29 template <class Q>
30 struct quat_traits;
31
32 template <class T>
33 struct
34 quat_traits< quat<T> >
35 {
36 typedef quat<T> this_quaternion;
37 typedef T scalar_type;
38
39 template <int I>
40 static
41 BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_CRITICAL
42 scalar_type
43 read_element( this_quaternion const & x )
44 {
45 BOOST_QVM_STATIC_ASSERT(I>=0);
46 BOOST_QVM_STATIC_ASSERT(I<4);
47 return x.a[I];
48 }
49
50 template <int I>
51 static
52 BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_CRITICAL
53 scalar_type &
54 write_element( this_quaternion & x )
55 {
56 BOOST_QVM_STATIC_ASSERT(I>=0);
57 BOOST_QVM_STATIC_ASSERT(I<4);
58 return x.a[I];
59 }
60 };
61
62 } }
63
64 #endif