]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/qvm/quat.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / qvm / quat.hpp
CommitLineData
1e59de90
TL
1#ifndef BOOST_QVM_QUAT_HPP_INCLUDED
2#define BOOST_QVM_QUAT_HPP_INCLUDED
92f5a8d4 3
1e59de90 4// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc.
92f5a8d4 5
1e59de90
TL
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)
92f5a8d4
TL
8
9#include <boost/qvm/detail/quat_assign.hpp>
10#include <boost/qvm/assert.hpp>
11#include <boost/qvm/static_assert.hpp>
12
1e59de90
TL
13namespace boost { namespace qvm {
14
15template <class T>
16struct
17quat
92f5a8d4 18 {
1e59de90
TL
19 T a[4];
20 template <class R>
21 operator R() const
92f5a8d4 22 {
1e59de90
TL
23 R r;
24 assign(r,*this);
25 return r;
26 }
27 };
92f5a8d4 28
1e59de90
TL
29template <class Q>
30struct quat_traits;
92f5a8d4 31
1e59de90
TL
32template <class T>
33struct
34quat_traits< quat<T> >
35 {
36 typedef quat<T> this_quaternion;
37 typedef T scalar_type;
92f5a8d4 38
1e59de90
TL
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 }
92f5a8d4 49
1e59de90
TL
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];
92f5a8d4 59 }
1e59de90
TL
60 };
61
62} }
92f5a8d4
TL
63
64#endif