QuadWord.h
Go to the documentation of this file.
1 #include "sick_scan/sick_scan_base.h" /* Base definitions included in all header files, added by add_sick_scan_base_header.py. Do not edit this line. */
2 /*
3 Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/
4 
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
10 
11 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
14 */
15 
16 
17 #ifndef TF2SIMD_QUADWORD_H
18 #define TF2SIMD_QUADWORD_H
19 
20 #include "Scalar.h"
21 #include "MinMax.h"
22 
23 
24 #if defined (__CELLOS_LV2) && defined (__SPU__)
25 #include <altivec.h>
26 #endif
27 
28 namespace tf2
29 {
33 #ifndef USE_LIBSPE2
34 ATTRIBUTE_ALIGNED16(class) QuadWord
35 #else
36 class QuadWord
37 #endif
38 {
39 protected:
40 
41 #if defined (__SPU__) && defined (__CELLOS_LV2__)
42  union {
43  vec_float4 mVec128;
44  tf2Scalar m_floats[4];
45  };
46 public:
47  vec_float4 get128() const
48  {
49  return mVec128;
50  }
51 protected:
52 #else //__CELLOS_LV2__ __SPU__
53  tf2Scalar m_floats[4];
54 #endif //__CELLOS_LV2__ __SPU__
55 
56  public:
57 
58 
60  TF2SIMD_FORCE_INLINE const tf2Scalar& getX() const { return m_floats[0]; }
62  TF2SIMD_FORCE_INLINE const tf2Scalar& getY() const { return m_floats[1]; }
64  TF2SIMD_FORCE_INLINE const tf2Scalar& getZ() const { return m_floats[2]; }
66  TF2SIMD_FORCE_INLINE void setX(tf2Scalar x) { m_floats[0] = x;};
68  TF2SIMD_FORCE_INLINE void setY(tf2Scalar y) { m_floats[1] = y;};
70  TF2SIMD_FORCE_INLINE void setZ(tf2Scalar z) { m_floats[2] = z;};
72  TF2SIMD_FORCE_INLINE void setW(tf2Scalar w) { m_floats[3] = w;};
74  TF2SIMD_FORCE_INLINE const tf2Scalar& x() const { return m_floats[0]; }
76  TF2SIMD_FORCE_INLINE const tf2Scalar& y() const { return m_floats[1]; }
78  TF2SIMD_FORCE_INLINE const tf2Scalar& z() const { return m_floats[2]; }
80  TF2SIMD_FORCE_INLINE const tf2Scalar& w() const { return m_floats[3]; }
81 
82  //TF2SIMD_FORCE_INLINE tf2Scalar& operator[](int i) { return (&m_floats[0])[i]; }
83  //TF2SIMD_FORCE_INLINE const tf2Scalar& operator[](int i) const { return (&m_floats[0])[i]; }
85  TF2SIMD_FORCE_INLINE operator tf2Scalar *() { return &m_floats[0]; }
86  TF2SIMD_FORCE_INLINE operator const tf2Scalar *() const { return &m_floats[0]; }
87 
88  TF2SIMD_FORCE_INLINE bool operator==(const QuadWord& other) const
89  {
90  return ((m_floats[3]==other.m_floats[3]) && (m_floats[2]==other.m_floats[2]) && (m_floats[1]==other.m_floats[1]) && (m_floats[0]==other.m_floats[0]));
91  }
92 
93  TF2SIMD_FORCE_INLINE bool operator!=(const QuadWord& other) const
94  {
95  return !(*this == other);
96  }
97 
103  TF2SIMD_FORCE_INLINE void setValue(const tf2Scalar& x, const tf2Scalar& y, const tf2Scalar& z)
104  {
105  m_floats[0]=x;
106  m_floats[1]=y;
107  m_floats[2]=z;
108  m_floats[3] = 0.f;
109  }
110 
111 /* void getValue(tf2Scalar *m) const
112  {
113  m[0] = m_floats[0];
114  m[1] = m_floats[1];
115  m[2] = m_floats[2];
116  }
117 */
124  TF2SIMD_FORCE_INLINE void setValue(const tf2Scalar& x, const tf2Scalar& y, const tf2Scalar& z,const tf2Scalar& w)
125  {
126  m_floats[0]=x;
127  m_floats[1]=y;
128  m_floats[2]=z;
129  m_floats[3]=w;
130  }
132  TF2SIMD_FORCE_INLINE QuadWord()
133  // :m_floats[0](tf2Scalar(0.)),m_floats[1](tf2Scalar(0.)),m_floats[2](tf2Scalar(0.)),m_floats[3](tf2Scalar(0.))
134  {
135  }
136 
142  TF2SIMD_FORCE_INLINE QuadWord(const tf2Scalar& x, const tf2Scalar& y, const tf2Scalar& z)
143  {
144  m_floats[0] = x, m_floats[1] = y, m_floats[2] = z, m_floats[3] = 0.0f;
145  }
146 
153  TF2SIMD_FORCE_INLINE QuadWord(const tf2Scalar& x, const tf2Scalar& y, const tf2Scalar& z,const tf2Scalar& w)
154  {
155  m_floats[0] = x, m_floats[1] = y, m_floats[2] = z, m_floats[3] = w;
156  }
157 
161  TF2SIMD_FORCE_INLINE void setMax(const QuadWord& other)
162  {
163  tf2SetMax(m_floats[0], other.m_floats[0]);
164  tf2SetMax(m_floats[1], other.m_floats[1]);
165  tf2SetMax(m_floats[2], other.m_floats[2]);
166  tf2SetMax(m_floats[3], other.m_floats[3]);
167  }
171  TF2SIMD_FORCE_INLINE void setMin(const QuadWord& other)
172  {
173  tf2SetMin(m_floats[0], other.m_floats[0]);
174  tf2SetMin(m_floats[1], other.m_floats[1]);
175  tf2SetMin(m_floats[2], other.m_floats[2]);
176  tf2SetMin(m_floats[3], other.m_floats[3]);
177  }
178 
179 
180 
181 };
182 
183 }
184 #endif //TF2SIMD_QUADWORD_H
Scalar.h
MinMax.h
tf2::ATTRIBUTE_ALIGNED16
ATTRIBUTE_ALIGNED16(class) QuadWord
The QuadWord class is base class for Vector3 and Quaternion. Some issues under PS3 Linux with IBM 2....
Definition: QuadWord.h:34
tf2::operator==
TF2SIMD_FORCE_INLINE bool operator==(const Matrix3x3 &m1, const Matrix3x3 &m2)
Equality operator between two matrices It will test all elements are equal.
Definition: Matrix3x3.h:640
TF2SIMD_FORCE_INLINE
#define TF2SIMD_FORCE_INLINE
Definition: Scalar.h:130
tf2SetMin
TF2SIMD_FORCE_INLINE void tf2SetMin(T &a, const T &b)
Definition: MinMax.h:40
tf2
sick_scan_base.h
tf2Scalar
double tf2Scalar
operator!=
bool operator!=(const TiXmlString &a, const TiXmlString &b)
Definition: tinystr.h:293
tf2SetMax
TF2SIMD_FORCE_INLINE void tf2SetMax(T &a, const T &b)
Definition: MinMax.h:49


sick_scan_xd
Author(s): Michael Lehning , Jochen Sprickerhof , Martin Günther
autogenerated on Fri Oct 25 2024 02:47:10