2 Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/
4 This software is provided 'as-is', without any express or implied warranty.
5 In no event will the authors be held liable for any damages arising from the use of this software.
6 Permission is granted to anyone to use this software for any purpose,
7 including commercial applications, and to alter it and redistribute it freely,
8 subject to the following restrictions:
10 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.
11 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
12 3. This notice may not be removed or altered from any source distribution.
16 #ifndef SIMD_QUADWORD_H
17 #define SIMD_QUADWORD_H
19 #include "SimdScalar.h"
28 ATTRIBUTE_ALIGNED16 (SimdScalar m_x);
35 SIMD_FORCE_INLINE SimdScalar& operator[](int i) { return (&m_x)[i]; }
36 SIMD_FORCE_INLINE const SimdScalar& operator[](int i) const { return (&m_x)[i]; }
38 SIMD_FORCE_INLINE const SimdScalar& getX() const { return m_x; }
40 SIMD_FORCE_INLINE const SimdScalar& getY() const { return m_y; }
42 SIMD_FORCE_INLINE const SimdScalar& getZ() const { return m_z; }
44 SIMD_FORCE_INLINE void setX(float x) { m_x = x;};
46 SIMD_FORCE_INLINE void setY(float y) { m_y = y;};
48 SIMD_FORCE_INLINE void setZ(float z) { m_z = z;};
50 SIMD_FORCE_INLINE const SimdScalar& x() const { return m_x; }
52 SIMD_FORCE_INLINE const SimdScalar& y() const { return m_y; }
54 SIMD_FORCE_INLINE const SimdScalar& z() const { return m_z; }
57 operator SimdScalar *() { return &m_x; }
58 operator const SimdScalar *() const { return &m_x; }
60 SIMD_FORCE_INLINE void setValue(const SimdScalar& x, const SimdScalar& y, const SimdScalar& z)
67 /* void getValue(SimdScalar *m) const
74 SIMD_FORCE_INLINE void setValue(const SimdScalar& x, const SimdScalar& y, const SimdScalar& z,const SimdScalar& w)
82 SIMD_FORCE_INLINE SimdQuadWord() :
83 m_x(0.f),m_y(0.f),m_z(0.f),m_unusedW(0.f)
87 SIMD_FORCE_INLINE SimdQuadWord(const SimdScalar& x, const SimdScalar& y, const SimdScalar& z)
89 //todo, remove this in release/simd ?
94 SIMD_FORCE_INLINE SimdQuadWord(const SimdScalar& x, const SimdScalar& y, const SimdScalar& z,const SimdScalar& w)
95 :m_x(x),m_y(y),m_z(z),m_unusedW(w)
100 SIMD_FORCE_INLINE void setMax(const SimdQuadWord& other)
111 if (other.m_unusedW > m_unusedW)
112 m_unusedW = other.m_unusedW;
115 SIMD_FORCE_INLINE void setMin(const SimdQuadWord& other)
126 if (other.m_unusedW < m_unusedW)
127 m_unusedW = other.m_unusedW;
134 #endif //SIMD_QUADWORD_H