19#if defined(JPH_USE_SSE4_1)
21#elif defined(JPH_USE_NEON)
24 for (
int i = 0;
i < 3;
i++)
32#if defined(JPH_USE_SSE)
34#elif defined(JPH_USE_NEON)
46template<u
int32 SwizzleX, u
int32 SwizzleY, u
int32 SwizzleZ, u
int32 SwizzleW>
49 static_assert(
SwizzleX <= 3,
"SwizzleX template parameter out of range");
50 static_assert(
SwizzleY <= 3,
"SwizzleY template parameter out of range");
51 static_assert(
SwizzleZ <= 3,
"SwizzleZ template parameter out of range");
52 static_assert(
SwizzleW <= 3,
"SwizzleW template parameter out of range");
54#if defined(JPH_USE_SSE)
56#elif defined(JPH_USE_NEON)
65#if defined(JPH_USE_SSE)
67#elif defined(JPH_USE_NEON)
70 return Vec4(0, 0, 0, 0);
76#if defined(JPH_USE_SSE)
78#elif defined(JPH_USE_NEON)
87 return sReplicate(numeric_limits<float>::quiet_NaN());
92#if defined(JPH_USE_SSE)
94#elif defined(JPH_USE_NEON)
103#if defined(JPH_USE_SSE)
105#elif defined(JPH_USE_NEON)
112template <const
int Scale>
115#if defined(JPH_USE_SSE)
130 float x = *
reinterpret_cast<const float *
>(
base +
inOffsets.GetX() * Scale);
131 float y = *
reinterpret_cast<const float *
>(
base +
inOffsets.GetY() * Scale);
132 float z = *
reinterpret_cast<const float *
>(
base +
inOffsets.GetZ() * Scale);
133 float w = *
reinterpret_cast<const float *
>(
base +
inOffsets.GetW() * Scale);
134 return Vec4(x, y, z, w);
140#if defined(JPH_USE_SSE)
142#elif defined(JPH_USE_NEON)
154#if defined(JPH_USE_SSE)
156#elif defined(JPH_USE_NEON)
168#if defined(JPH_USE_SSE)
170#elif defined(JPH_USE_NEON)
174 inV1.mF32[1] == inV2.
mF32[1]? 0xffffffffu : 0,
175 inV1.mF32[2] == inV2.
mF32[2]? 0xffffffffu : 0,
176 inV1.mF32[3] == inV2.
mF32[3]? 0xffffffffu : 0);
182#if defined(JPH_USE_SSE)
184#elif defined(JPH_USE_NEON)
188 inV1.mF32[1] < inV2.
mF32[1]? 0xffffffffu : 0,
189 inV1.mF32[2] < inV2.
mF32[2]? 0xffffffffu : 0,
190 inV1.mF32[3] < inV2.
mF32[3]? 0xffffffffu : 0);
196#if defined(JPH_USE_SSE)
198#elif defined(JPH_USE_NEON)
202 inV1.mF32[1] <= inV2.
mF32[1]? 0xffffffffu : 0,
203 inV1.mF32[2] <= inV2.
mF32[2]? 0xffffffffu : 0,
204 inV1.mF32[3] <= inV2.
mF32[3]? 0xffffffffu : 0);
210#if defined(JPH_USE_SSE)
212#elif defined(JPH_USE_NEON)
216 inV1.mF32[1] > inV2.
mF32[1]? 0xffffffffu : 0,
217 inV1.mF32[2] > inV2.
mF32[2]? 0xffffffffu : 0,
218 inV1.mF32[3] > inV2.
mF32[3]? 0xffffffffu : 0);
224#if defined(JPH_USE_SSE)
226#elif defined(JPH_USE_NEON)
230 inV1.mF32[1] >= inV2.
mF32[1]? 0xffffffffu : 0,
231 inV1.mF32[2] >= inV2.
mF32[2]? 0xffffffffu : 0,
232 inV1.mF32[3] >= inV2.
mF32[3]? 0xffffffffu : 0);
238#if defined(JPH_USE_SSE)
244#elif defined(JPH_USE_NEON)
256#if defined(JPH_USE_SSE4_1)
258#elif defined(JPH_USE_NEON)
262 for (
int i = 0;
i < 4;
i++)
270#if defined(JPH_USE_SSE)
272#elif defined(JPH_USE_NEON)
281#if defined(JPH_USE_SSE)
283#elif defined(JPH_USE_NEON)
292#if defined(JPH_USE_SSE)
294#elif defined(JPH_USE_NEON)
366#if defined(JPH_USE_AVX512)
368#elif defined(JPH_USE_SSE)
370#elif defined(JPH_USE_NEON)
374 return isnan(
mF32[0]) || isnan(
mF32[1]) || isnan(
mF32[2]) || isnan(
mF32[3]);
380#if defined(JPH_USE_SSE)
382#elif defined(JPH_USE_NEON)
394#if defined(JPH_USE_SSE)
396#elif defined(JPH_USE_NEON)
406#if defined(JPH_USE_SSE)
408#elif defined(JPH_USE_NEON)
420#if defined(JPH_USE_SSE)
422#elif defined(JPH_USE_NEON)
431#if defined(JPH_USE_SSE)
433#elif defined(JPH_USE_NEON)
436 for (
int i = 0;
i < 4; ++
i)
444#if defined(JPH_USE_SSE)
446#elif defined(JPH_USE_NEON)
449 for (
int i = 0;
i < 4; ++
i)
457#if defined(JPH_USE_SSE)
459#elif defined(JPH_USE_NEON)
462 for (
int i = 0;
i < 4; ++
i)
470#if defined(JPH_USE_SSE)
472#elif defined(JPH_USE_NEON)
484#if defined(JPH_USE_SSE)
486#elif defined(JPH_USE_NEON)
489 for (
int i = 0;
i < 4; ++
i)
497#if defined(JPH_USE_SSE)
499#elif defined(JPH_USE_NEON)
508#if defined(JPH_USE_SSE)
510#elif defined(JPH_USE_NEON)
522#if defined(JPH_USE_SSE)
524#elif defined(JPH_USE_NEON)
527 for (
int i = 0;
i < 4; ++
i)
535#if defined(JPH_USE_SSE)
537#elif defined(JPH_USE_NEON)
549#if defined(JPH_USE_SSE)
551#elif defined(JPH_USE_NEON)
560#if defined(JPH_USE_SSE)
562#elif defined(JPH_USE_NEON)
571#if defined(JPH_USE_SSE)
573#elif defined(JPH_USE_NEON)
582#if defined(JPH_USE_SSE)
584#elif defined(JPH_USE_NEON)
593#if defined(JPH_USE_AVX512)
595#elif defined(JPH_USE_SSE)
597#elif defined(JPH_USE_NEON)
611#if defined(JPH_USE_SSE4_1)
613#elif defined(JPH_USE_NEON)
624#if defined(JPH_USE_SSE4_1)
626#elif defined(JPH_USE_NEON)
637#if defined(JPH_USE_SSE4_1)
639#elif defined(JPH_USE_NEON)
650#if defined(JPH_USE_SSE4_1)
652#elif defined(JPH_USE_NEON)
664#if defined(JPH_USE_SSE)
666#elif defined(JPH_USE_NEON)
676#if defined(JPH_USE_AVX512)
678#elif defined(JPH_USE_SSE)
682#elif defined(JPH_USE_NEON)
696#if defined(JPH_USE_SSE4_1)
698#elif defined(JPH_USE_NEON)
709#if defined(JPH_USE_SSE)
711#elif defined(JPH_USE_NEON)
714 for (
int i = 0;
i < 4; ++
i)
721#if defined(JPH_USE_SSE)
723#elif defined(JPH_USE_NEON)
732#if defined(JPH_USE_SSE)
734#elif defined(JPH_USE_NEON)
737 return *
reinterpret_cast<const UVec4 *
>(
this);
743#if defined(JPH_USE_SSE)
745#elif defined(JPH_USE_NEON)
std::uint8_t uint8
Definition Core.h:440
std::uint64_t uint64
Definition Core.h:443
#define JPH_NAMESPACE_END
Definition Core.h:367
std::uint32_t uint32
Definition Core.h:442
#define JPH_IF_FLOATING_POINT_EXCEPTIONS_ENABLED(...)
Definition Core.h:494
#define JPH_NAMESPACE_BEGIN
Definition Core.h:361
AllocateFunction Allocate
Definition Memory.cpp:59
@ SWIZZLE_Z
Use the Z component.
Definition Swizzle.h:14
@ SWIZZLE_W
Use the W component.
Definition Swizzle.h:15
@ SWIZZLE_X
Use the X component.
Definition Swizzle.h:12
@ SWIZZLE_UNUSED
We always use the Z component when we don't specifically want to initialize a value,...
Definition Swizzle.h:16
@ SWIZZLE_Y
Use the Y component.
Definition Swizzle.h:13
Vec4 operator*(float inV1, Vec4Arg inV2)
Multiply vector with float.
Definition Vec4.inl:404
Class that holds 4 float values. Convert to Vec4 to perform calculations.
Definition Float4.h:11
JPH_INLINE UVec4 Swizzle() const
Swizzle the elements in inV.
JPH_INLINE UVec4 LogicalShiftLeft() const
Shift all components by Count bits to the left (filling with zeros from the left)
static JPH_INLINE UVec4 sReplicate(uint32 inV)
Replicate int inV across all components.
Definition UVec4.inl:56
JPH_INLINE bool TestAllTrue() const
Test if all components are true (true is when highest bit of component is set)
Definition UVec4.inl:400
static JPH_INLINE UVec4 sAnd(UVec4Arg inV1, UVec4Arg inV2)
Logical and (component wise)
Definition UVec4.inl:194
static JPH_INLINE UVec4 sOr(UVec4Arg inV1, UVec4Arg inV2)
Logical or (component wise)
Definition UVec4.inl:166
static JPH_INLINE UVec4 sXor(UVec4Arg inV1, UVec4Arg inV2)
Logical xor (component wise)
Definition UVec4.inl:180
static JPH_INLINE UVec4 sSelect(UVec4Arg inV1, UVec4Arg inV2, UVec4Arg inControl)
Component wise select, returns inV1 when highest bit of inControl = 0 and inV2 when highest bit of in...
Definition UVec4.inl:152
JPH_INLINE Vec4 ReinterpretAsFloat() const
Reinterpret UVec4 as a Vec4 (doesn't change the bits)
Definition UVec4.inl:332
JPH_INLINE Vec4 SplatX() const
Replicate the X component to all components.
Definition Vec4.inl:547
static JPH_INLINE void sSort4(Vec4 &ioValue, UVec4 &ioIndex)
Definition Vec4.inl:301
Vec4 ATan() const
Calculate the arc tangent for each element of this vector (returns value in the range [-PI / 2,...
Definition Vec4.inl:903
static JPH_INLINE UVec4 sGreater(Vec4Arg inV1, Vec4Arg inV2)
Greater than (component wise)
Definition Vec4.inl:208
float mF32[4]
Definition Vec4.h:275
JPH_INLINE Vec4 operator-() const
Negate.
Definition Vec4.inl:495
Vec4()=default
Constructor.
static JPH_INLINE Vec4 sAnd(Vec4Arg inV1, Vec4Arg inV2)
Logical and (component wise)
Definition Vec4.inl:290
static JPH_INLINE Vec4 sLoadFloat4Aligned(const Float4 *inV)
Load 4 floats from memory, 16 bytes aligned.
Definition Vec4.inl:101
static Vec4 sATan2(Vec4Arg inY, Vec4Arg inX)
Calculate the arc tangent of y / x using the signs of the arguments to determine the correct quadrant...
Definition Vec4.inl:937
JPH_INLINE Vec4 GetSign() const
Get vector that contains the sign of each element (returns 1.0f if positive, -1.0f if negative)
Definition Vec4.inl:674
Vec4 ASin() const
Definition Vec4.inl:862
static JPH_INLINE Vec4 sXor(Vec4Arg inV1, Vec4Arg inV2)
Logical xor (component wise)
Definition Vec4.inl:279
JPH_INLINE Vec4 Abs() const
Return the absolute value of each of the components.
Definition Vec4.inl:591
JPH_INLINE Vec4 operator/(float inV2) const
Divide vector by float.
Definition Vec4.inl:418
Vec4 Tan() const
Calculate the tangent for each element of this vector (input in radians)
Definition Vec4.inl:829
JPH_INLINE UVec4 ToInt() const
Convert each component from a float to an int.
Definition Vec4.inl:719
JPH_INLINE Vec4 & operator+=(Vec4Arg inV2)
Add two float vectors (component wise)
Definition Vec4.inl:482
static JPH_INLINE UVec4 sLessOrEqual(Vec4Arg inV1, Vec4Arg inV2)
Less than or equal (component wise)
Definition Vec4.inl:194
static JPH_INLINE UVec4 sLess(Vec4Arg inV1, Vec4Arg inV2)
Less than (component wise)
Definition Vec4.inl:180
JPH_INLINE float Length() const
Length of vector.
Definition Vec4.inl:648
static JPH_INLINE void sSort4Reverse(Vec4 &ioValue, UVec4 &ioIndex)
Definition Vec4.inl:325
static JPH_INLINE Vec4 sFusedMultiplyAdd(Vec4Arg inMul1, Vec4Arg inMul2, Vec4Arg inAdd)
Calculates inMul1 * inMul2 + inAdd.
Definition Vec4.inl:236
JPH_INLINE Vec4 Normalized() const
Normalize vector.
Definition Vec4.inl:694
static JPH_INLINE UVec4 sEquals(Vec4Arg inV1, Vec4Arg inV2)
Equals (component wise)
Definition Vec4.inl:166
static JPH_INLINE Vec4 sSelect(Vec4Arg inV1, Vec4Arg inV2, UVec4Arg inControl)
Component wise select, returns inV1 when highest bit of inControl = 0 and inV2 when highest bit of in...
Definition Vec4.inl:254
JPH_INLINE float ReduceMax() const
Get the maximum of X, Y, Z and W.
Definition Vec4.inl:760
JPH_INLINE Vec4 Reciprocal() const
Reciprocal vector (1 / value) for each of the components.
Definition Vec4.inl:604
JPH_INLINE Vec4 SplatY() const
Replicate the Y component to all components.
Definition Vec4.inl:558
JPH_INLINE UVec4 ReinterpretAsInt() const
Reinterpret Vec4 as a UVec4 (doesn't change the bits)
Definition Vec4.inl:730
static JPH_INLINE UVec4 sGreaterOrEqual(Vec4Arg inV1, Vec4Arg inV2)
Greater than or equal (component wise)
Definition Vec4.inl:222
static JPH_INLINE Vec4 sMin(Vec4Arg inV1, Vec4Arg inV2)
Return the minimum value of each of the components.
Definition Vec4.inl:138
JPH_INLINE Vec4 SplatZ() const
Replicate the Z component to all components.
Definition Vec4.inl:569
JPH_INLINE Vec4 Sqrt() const
Component wise square root.
Definition Vec4.inl:662
JPH_INLINE Vec4 & operator*=(float inV2)
Multiply vector with float.
Definition Vec4.inl:429
static JPH_INLINE Vec4 sGatherFloat4(const float *inBase, UVec4Arg inOffsets)
Gather 4 floats from memory at inBase + inOffsets[i] * Scale.
JPH_INLINE Vec4 operator+(Vec4Arg inV2) const
Add two float vectors (component wise)
Definition Vec4.inl:468
JPH_INLINE Vec4 & operator/=(float inV2)
Divide vector by float.
Definition Vec4.inl:455
JPH_INLINE bool IsNormalized(float inTolerance=1.0e-6f) const
Test if vector is normalized.
Definition Vec4.inl:359
JPH_INLINE bool operator==(Vec4Arg inV2) const
Comparison.
Definition Vec4.inl:349
JPH_INLINE Vec4 SplatW() const
Replicate the W component to all components.
Definition Vec4.inl:580
JPH_INLINE Vec4 DotV(Vec4Arg inV2) const
Dot product, returns the dot product in X, Y and Z components.
Definition Vec4.inl:609
JPH_INLINE bool IsClose(Vec4Arg inV2, float inMaxDistSq=1.0e-12f) const
Test if two vectors are close.
Definition Vec4.inl:354
static JPH_INLINE Vec4 sLoadFloat4(const Float4 *inV)
Load 4 floats from memory.
Definition Vec4.inl:90
static JPH_INLINE Vec4 sZero()
Vector with all zeros.
Definition Vec4.inl:63
JPH_INLINE Vec4 Swizzle() const
Swizzle the elements in inV.
struct { float mData[4];} Type
Definition Vec4.h:24
static JPH_INLINE Vec4 sOr(Vec4Arg inV1, Vec4Arg inV2)
Logical or (component wise)
Definition Vec4.inl:268
JPH_INLINE float ReduceMin() const
Get the minimum of X, Y, Z and W.
Definition Vec4.inl:753
Type mValue
Definition Vec4.h:274
JPH_INLINE Vec4 & operator-=(Vec4Arg inV2)
Add two float vectors (component wise)
Definition Vec4.inl:520
JPH_INLINE float LengthSq() const
Squared length of vector.
Definition Vec4.inl:635
static JPH_INLINE Vec4 sMax(Vec4Arg inV1, Vec4Arg inV2)
Return the maximum of each of the components.
Definition Vec4.inl:152
JPH_INLINE float Dot(Vec4Arg inV2) const
Dot product.
Definition Vec4.inl:622
JPH_INLINE bool IsNaN() const
Test if vector contains NaN elements.
Definition Vec4.inl:364
static JPH_INLINE Vec4 sNaN()
Vector with all NaN's.
Definition Vec4.inl:85
Vec4 ACos() const
Definition Vec4.inl:897
JPH_INLINE int GetSignBits() const
Store if X is negative in bit 0, Y in bit 1, Z in bit 2 and W in bit 3.
Definition Vec4.inl:741
static JPH_INLINE Vec4 sReplicate(float inV)
Replicate inV across all components.
Definition Vec4.inl:74
void SinCos(Vec4 &outSin, Vec4 &outCos) const
Calculate the sine and cosine for each element of this vector (input in radians)
Definition Vec4.inl:767
JPH_INLINE void StoreFloat4(Float4 *outV) const
Store 4 floats to memory.
Definition Vec4.inl:707
friend JPH_INLINE Vec4 operator*(float inV1, Vec4Arg inV2)
Multiply vector with float.
Definition Vec4.inl:404