Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
UVec8.h
Go to the documentation of this file.
1// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
2// SPDX-FileCopyrightText: 2021 Jorrit Rouwe
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
7#include <Jolt/Math/Vec8.h>
8
10
11class [[nodiscard]] UVec8
12{
13public:
15
16 UVec8() = default;
17 UVec8(const UVec8 &inRHS) = default;
18 JPH_INLINE UVec8(__m256i inRHS) : mValue(inRHS) { }
19
21 JPH_INLINE UVec8(UVec4Arg inLo, UVec4Arg inHi);
22
24 JPH_INLINE bool operator == (UVec8Arg inV2) const;
25 JPH_INLINE bool operator != (UVec8Arg inV2) const { return !(*this == inV2); }
26
28 static JPH_INLINE UVec8 sReplicate(uint32 inV);
29
31 static JPH_INLINE UVec8 sSplatX(UVec4Arg inV);
32
34 static JPH_INLINE UVec8 sSplatY(UVec4Arg inV);
35
37 static JPH_INLINE UVec8 sSplatZ(UVec4Arg inV);
38
40 static JPH_INLINE UVec8 sEquals(UVec8Arg inV1, UVec8Arg inV2);
41
43 static JPH_INLINE UVec8 sSelect(UVec8Arg inV1, UVec8Arg inV2, UVec8Arg inControl);
44
46 static JPH_INLINE UVec8 sOr(UVec8Arg inV1, UVec8Arg inV2);
47
49 static JPH_INLINE UVec8 sXor(UVec8Arg inV1, UVec8Arg inV2);
50
52 static JPH_INLINE UVec8 sAnd(UVec8Arg inV1, UVec8Arg inV2);
53
55 JPH_INLINE uint32 operator [] (uint inCoordinate) const { JPH_ASSERT(inCoordinate < 8); return mU32[inCoordinate]; }
56 JPH_INLINE uint32 & operator [] (uint inCoordinate) { JPH_ASSERT(inCoordinate < 8); return mU32[inCoordinate]; }
57
59 template<uint32 SwizzleX, uint32 SwizzleY, uint32 SwizzleZ, uint32 SwizzleW>
60 JPH_INLINE UVec8 Swizzle() const;
61
63 JPH_INLINE bool TestAnyTrue() const;
64
66 JPH_INLINE bool TestAllTrue() const;
67
69 JPH_INLINE UVec4 LowerVec4() const;
70
72 JPH_INLINE UVec4 UpperVec4() const;
73
75 JPH_INLINE Vec8 ToFloat() const;
76
78 template <const uint Count>
79 JPH_INLINE UVec8 LogicalShiftLeft() const;
80
82 template <const uint Count>
83 JPH_INLINE UVec8 LogicalShiftRight() const;
84
86 template <const uint Count>
87 JPH_INLINE UVec8 ArithmeticShiftRight() const;
88
89 union
90 {
91 __m256i mValue;
92 uint32 mU32[8];
93 };
94};
95
96static_assert(is_trivial<UVec8>(), "Is supposed to be a trivial type!");
97
99
100#include "UVec8.inl"
unsigned int uint
Definition: Core.h:439
#define JPH_NAMESPACE_END
Definition: Core.h:367
std::uint32_t uint32
Definition: Core.h:442
#define JPH_NAMESPACE_BEGIN
Definition: Core.h:361
#define JPH_ASSERT(...)
Definition: IssueReporting.h:33
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition: Memory.h:29
Definition: UVec4.h:12
Definition: UVec8.h:12
JPH_OVERRIDE_NEW_DELETE UVec8()=default
Intentionally not initialized for performance reasons.
JPH_INLINE UVec8 Swizzle() const
256 bit variant of Vec::Swizzle (no cross 128 bit lane swizzle)
JPH_INLINE UVec8 ArithmeticShiftRight() const
Shift all components by Count bits to the right (shifting in the value of the highest bit)
JPH_INLINE UVec8 LogicalShiftRight() const
Shift all components by Count bits to the right (filling with zeros from the right)
JPH_INLINE UVec8(__m256i inRHS)
Definition: UVec8.h:18
UVec8(const UVec8 &inRHS)=default
__m256i mValue
Definition: UVec8.h:91
JPH_INLINE UVec8 LogicalShiftLeft() const
Shift all components by Count bits to the left (filling with zeros from the left)
Definition: Vec8.h:12