commonlibsse_ng\re\h/
hkSseMathTypes.rs

1use core::arch::x86_64::__m128;
2
3/// Alias for a 128-bit SSE vector type used in Havok.
4///
5/// This corresponds to `__m128` from the C++ code.
6pub type hkQuadReal = __m128;
7
8// Compile-time size verification for hkQuadReal
9const _: () = {
10    assert!(core::mem::size_of::<hkQuadReal>() == 0x10);
11};
12
13/// Represents a comparison mask for `hkVector4` operations in the Havok system.
14///
15/// This struct uses a `hkQuadReal` to store a mask for vector component comparisons.
16///
17/// # Memory Layout:
18/// - `mask`: SSE-aligned 128-bit vector (0x00 - 0x0F)
19#[repr(C)]
20#[derive(Clone, Copy)]
21pub struct hkVector4Comparison {
22    /// The 128-bit SSE vector used as a comparison mask.
23    /// - Offset: 0x00
24    pub mask: hkQuadReal,
25}
26
27// Compile-time memory layout verification
28const _: () = {
29    assert!(core::mem::offset_of!(hkVector4Comparison, mask) == 0x0);
30    assert!(core::mem::size_of::<hkVector4Comparison>() == 0x10);
31};
32
33impl Default for hkVector4Comparison {
34    #[inline]
35    fn default() -> Self {
36        Self {
37            mask: unsafe { core::arch::x86_64::_mm_setzero_ps() }, // Zero-initialized mask
38        }
39    }
40}
41
42/// Enumeration of mask values for component-wise comparisons.
43#[commonlibsse_ng_derive_internal::to_bitflags]
44#[repr(u32)]
45#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
46pub enum Mask {
47    #[default]
48    None = 0,
49
50    X = 1,
51    Y = 2,
52    XY = 3,
53
54    Z = 4,
55    XZ = 5,
56    YZ = 6,
57    XYZ = 7,
58
59    W = 8,
60    XW = 9,
61    YW = 10,
62    XYW = 11,
63
64    ZW = 12,
65    XZW = 13,
66    YZW = 14,
67    XYZW = 15,
68}