Plasma Engine  2.0
Loading...
Searching...
No Matches
FPUFloat_inl.h
1#pragma once
2
3PL_ALWAYS_INLINE plSimdFloat::plSimdFloat() {}
4
5PL_ALWAYS_INLINE plSimdFloat::plSimdFloat(float f)
6{
7 m_v.Set(f);
8}
9
10PL_ALWAYS_INLINE plSimdFloat::plSimdFloat(plInt32 i)
11{
12 m_v.Set((float)i);
13}
14
15PL_ALWAYS_INLINE plSimdFloat::plSimdFloat(plUInt32 i)
16{
17 m_v.Set((float)i);
18}
19
21{
22 m_v.Set(a.GetRadian());
23}
24
26{
27 m_v = v;
28}
29
30PL_ALWAYS_INLINE plSimdFloat::operator float() const
31{
32 return m_v.x;
33}
34
35// static
37{
38 return plSimdFloat(0.0f);
39}
40
41// static
43{
45}
46
47PL_ALWAYS_INLINE plSimdFloat plSimdFloat::operator+(const plSimdFloat& f) const
48{
49 return m_v + f.m_v;
50}
51
52PL_ALWAYS_INLINE plSimdFloat plSimdFloat::operator-(const plSimdFloat& f) const
53{
54 return m_v - f.m_v;
55}
56
57PL_ALWAYS_INLINE plSimdFloat plSimdFloat::operator*(const plSimdFloat& f) const
58{
59 return m_v.CompMul(f.m_v);
60}
61
62PL_ALWAYS_INLINE plSimdFloat plSimdFloat::operator/(const plSimdFloat& f) const
63{
64 return m_v.CompDiv(f.m_v);
65}
66
67PL_ALWAYS_INLINE plSimdFloat& plSimdFloat::operator+=(const plSimdFloat& f)
68{
69 m_v += f.m_v;
70 return *this;
71}
72
73PL_ALWAYS_INLINE plSimdFloat& plSimdFloat::operator-=(const plSimdFloat& f)
74{
75 m_v -= f.m_v;
76 return *this;
77}
78
79PL_ALWAYS_INLINE plSimdFloat& plSimdFloat::operator*=(const plSimdFloat& f)
80{
81 m_v = m_v.CompMul(f.m_v);
82 return *this;
83}
84
85PL_ALWAYS_INLINE plSimdFloat& plSimdFloat::operator/=(const plSimdFloat& f)
86{
87 m_v = m_v.CompDiv(f.m_v);
88 return *this;
89}
90
91PL_ALWAYS_INLINE bool plSimdFloat::IsEqual(const plSimdFloat& rhs, const plSimdFloat& fEpsilon) const
92{
93 return m_v.IsEqual(rhs.m_v, fEpsilon);
94}
95
96PL_ALWAYS_INLINE bool plSimdFloat::operator==(const plSimdFloat& f) const
97{
98 return m_v.x == f.m_v.x;
99}
100
101PL_ALWAYS_INLINE bool plSimdFloat::operator!=(const plSimdFloat& f) const
102{
103 return m_v.x != f.m_v.x;
104}
105
106PL_ALWAYS_INLINE bool plSimdFloat::operator>=(const plSimdFloat& f) const
107{
108 return m_v.x >= f.m_v.x;
109}
110
111PL_ALWAYS_INLINE bool plSimdFloat::operator>(const plSimdFloat& f) const
112{
113 return m_v.x > f.m_v.x;
114}
115
116PL_ALWAYS_INLINE bool plSimdFloat::operator<=(const plSimdFloat& f) const
117{
118 return m_v.x <= f.m_v.x;
119}
120
121PL_ALWAYS_INLINE bool plSimdFloat::operator<(const plSimdFloat& f) const
122{
123 return m_v.x < f.m_v.x;
124}
125
126PL_ALWAYS_INLINE bool plSimdFloat::operator==(float f) const
127{
128 return m_v.x == f;
129}
130
131PL_ALWAYS_INLINE bool plSimdFloat::operator!=(float f) const
132{
133 return m_v.x != f;
134}
135
136PL_ALWAYS_INLINE bool plSimdFloat::operator>(float f) const
137{
138 return m_v.x > f;
139}
140
141PL_ALWAYS_INLINE bool plSimdFloat::operator>=(float f) const
142{
143 return m_v.x >= f;
144}
145
146PL_ALWAYS_INLINE bool plSimdFloat::operator<(float f) const
147{
148 return m_v.x < f;
149}
150
151PL_ALWAYS_INLINE bool plSimdFloat::operator<=(float f) const
152{
153 return m_v.x <= f;
154}
155
156template <plMathAcc::Enum acc>
157PL_ALWAYS_INLINE plSimdFloat plSimdFloat::GetReciprocal() const
158{
159 return plSimdFloat(1.0f / m_v.x);
160}
161
162template <plMathAcc::Enum acc>
163PL_ALWAYS_INLINE plSimdFloat plSimdFloat::GetSqrt() const
164{
165 return plSimdFloat(plMath::Sqrt(m_v.x));
166}
167
168template <plMathAcc::Enum acc>
169PL_ALWAYS_INLINE plSimdFloat plSimdFloat::GetInvSqrt() const
170{
171 return plSimdFloat(1.0f / plMath::Sqrt(m_v.x));
172}
173
174PL_ALWAYS_INLINE plSimdFloat plSimdFloat::Max(const plSimdFloat& f) const
175{
176 return m_v.CompMax(f.m_v);
177}
178
179PL_ALWAYS_INLINE plSimdFloat plSimdFloat::Min(const plSimdFloat& f) const
180{
181 return m_v.CompMin(f.m_v);
182}
183
184PL_ALWAYS_INLINE plSimdFloat plSimdFloat::Abs() const
185{
186 return plSimdFloat(plMath::Abs(m_v.x));
187}
Float wrapper struct for a safe usage and conversions of angles.
Definition Angle.h:10
constexpr float GetRadian() const
Returns the radian value. (No need for any conversion)
Definition Angle_inl.h:48
Definition SimdFloat.h:7
plSimdFloat()
Default constructor, leaves the data uninitialized.
Definition FPUFloat_inl.h:3
static plSimdFloat MakeNaN()
Creates an plSimdFloat that is initialized to Not-A-Number (NaN).
Definition FPUFloat_inl.h:42
static plSimdFloat MakeZero()
Creates an plSimdFloat that is initialized to zero.
Definition FPUFloat_inl.h:36
const plVec4Template< Type > CompMin(const plVec4Template< Type > &rhs) const
Returns the component-wise minimum of *this and rhs.
Definition Vec4_inl.h:327
bool IsEqual(const plVec4Template< Type > &rhs, Type fEpsilon) const
Equality Check with epsilon.
Definition Vec4_inl.h:444
const plVec4Template< Type > CompDiv(const plVec4Template< Type > &rhs) const
Returns the component-wise division of *this and rhs.
Definition Vec4_inl.h:366
void Set(Type xyzw)
Sets all 4 components to this value.
Definition Vec4_inl.h:121
const plVec4Template< Type > CompMul(const plVec4Template< Type > &rhs) const
Returns the component-wise multiplication of *this and rhs.
Definition Vec4_inl.h:355
const plVec4Template< Type > CompMax(const plVec4Template< Type > &rhs) const
Returns the component-wise maximum of *this and rhs.
Definition Vec4_inl.h:336
constexpr TYPE NaN()
Returns the value for NaN as the template type. Returns zero, if the type does not support NaN.
Definition Constants_inl.h:58
PL_ALWAYS_INLINE double Sqrt(double f)
Returns the square root of f.
Definition MathDouble_inl.h:99
constexpr PL_ALWAYS_INLINE T Abs(T f)
Returns the absolute value of f.
Definition Math_inl.h:21