| 1 | use crate::{DMat2, DMat3, DMat4, DQuat, DVec2, DVec3, DVec4}; |
| 2 | use crate::{IVec2, IVec3, IVec4}; |
| 3 | use crate::{Mat2, Mat3, Mat3A, Mat4, Quat, Vec2, Vec3, Vec3A, Vec4}; |
| 4 | use crate::{UVec2, UVec3, UVec4}; |
| 5 | #[cfg(target_feature = "simd128")] |
| 6 | use core::arch::wasm32::v128; |
| 7 | #[cfg(target_arch = "x86")] |
| 8 | use core::arch::x86::*; |
| 9 | #[cfg(target_arch = "x86_64")] |
| 10 | use core::arch::x86_64::*; |
| 11 | |
| 12 | #[repr(C)] |
| 13 | pub union Vec4Cast { |
| 14 | #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] |
| 15 | pub m128: __m128, |
| 16 | #[cfg(target_feature = "simd128")] |
| 17 | pub v128: v128, |
| 18 | pub fx4: [f32; 4], |
| 19 | pub fx2x2: [[f32; 2]; 2], |
| 20 | pub v4: Vec4, |
| 21 | pub v3a: Vec3A, |
| 22 | pub q: Quat, |
| 23 | } |
| 24 | |
| 25 | #[repr(C)] |
| 26 | pub union Vec3Cast { |
| 27 | pub fx3: [f32; 3], |
| 28 | pub v3: Vec3, |
| 29 | } |
| 30 | |
| 31 | #[repr(C)] |
| 32 | pub union Vec2Cast { |
| 33 | pub fx2: [f32; 2], |
| 34 | pub v2: Vec2, |
| 35 | } |
| 36 | |
| 37 | #[repr(C)] |
| 38 | pub union F32x9Cast { |
| 39 | pub fx3x3: [[f32; 3]; 3], |
| 40 | pub fx9: [f32; 9], |
| 41 | } |
| 42 | |
| 43 | #[repr(C)] |
| 44 | pub union F32x16Cast { |
| 45 | pub fx4x4: [[f32; 4]; 4], |
| 46 | pub fx16: [f32; 16], |
| 47 | } |
| 48 | |
| 49 | #[repr(C)] |
| 50 | pub union Mat4Cast { |
| 51 | pub v4x4: [Vec4; 4], |
| 52 | pub m4: Mat4, |
| 53 | } |
| 54 | |
| 55 | #[repr(C)] |
| 56 | pub union Mat3Cast { |
| 57 | pub v3x3: [Vec3; 3], |
| 58 | pub m3: Mat3, |
| 59 | } |
| 60 | |
| 61 | #[repr(C)] |
| 62 | pub union Mat3ACast { |
| 63 | pub v3x3: [Vec3A; 3], |
| 64 | pub m3: Mat3A, |
| 65 | } |
| 66 | |
| 67 | #[repr(C)] |
| 68 | pub union Mat2Cast { |
| 69 | pub v2x2: [Vec2; 2], |
| 70 | pub m2: Mat2, |
| 71 | } |
| 72 | |
| 73 | #[repr(C)] |
| 74 | pub union DVec4Cast { |
| 75 | pub fx4: [f64; 4], |
| 76 | pub fx2x2: [[f64; 2]; 2], |
| 77 | pub v4: DVec4, |
| 78 | pub q: DQuat, |
| 79 | } |
| 80 | |
| 81 | #[repr(C)] |
| 82 | pub union DVec3Cast { |
| 83 | pub fx3: [f64; 3], |
| 84 | pub v3: DVec3, |
| 85 | } |
| 86 | |
| 87 | #[repr(C)] |
| 88 | pub union DVec2Cast { |
| 89 | pub fx2: [f64; 2], |
| 90 | pub v2: DVec2, |
| 91 | } |
| 92 | |
| 93 | #[repr(C)] |
| 94 | pub union F64x9Cast { |
| 95 | pub fx3x3: [[f64; 3]; 3], |
| 96 | pub fx9: [f64; 9], |
| 97 | } |
| 98 | |
| 99 | #[repr(C)] |
| 100 | pub union F64x16Cast { |
| 101 | pub fx4x4: [[f64; 4]; 4], |
| 102 | pub fx16: [f64; 16], |
| 103 | } |
| 104 | |
| 105 | #[repr(C)] |
| 106 | pub union DMat4Cast { |
| 107 | pub v4x4: [DVec4; 4], |
| 108 | pub m4: DMat4, |
| 109 | } |
| 110 | |
| 111 | #[repr(C)] |
| 112 | pub union DMat3Cast { |
| 113 | pub v3x3: [DVec3; 3], |
| 114 | pub m3: DMat3, |
| 115 | } |
| 116 | |
| 117 | #[repr(C)] |
| 118 | pub union DMat2Cast { |
| 119 | pub v2x2: [DVec2; 2], |
| 120 | pub m2: DMat2, |
| 121 | } |
| 122 | |
| 123 | #[repr(C)] |
| 124 | pub union IVec4Cast { |
| 125 | #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] |
| 126 | pub m128: __m128i, |
| 127 | #[cfg(target_feature = "simd128")] |
| 128 | pub v128: v128, |
| 129 | pub ix4: [i32; 4], |
| 130 | pub ix2x2: [[i32; 2]; 2], |
| 131 | pub v4: IVec4, |
| 132 | } |
| 133 | |
| 134 | #[repr(C)] |
| 135 | pub union IVec3Cast { |
| 136 | pub ix3: [i32; 3], |
| 137 | pub v3: IVec3, |
| 138 | } |
| 139 | |
| 140 | #[repr(C)] |
| 141 | pub union IVec2Cast { |
| 142 | pub ix2: [i32; 2], |
| 143 | pub v2: IVec2, |
| 144 | } |
| 145 | |
| 146 | #[repr(C)] |
| 147 | pub union UVec4Cast { |
| 148 | #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] |
| 149 | pub m128: __m128, |
| 150 | #[cfg(target_feature = "simd128")] |
| 151 | pub v128: v128, |
| 152 | pub ux4: [u32; 4], |
| 153 | pub ux2x2: [[u32; 2]; 2], |
| 154 | pub v4: UVec4, |
| 155 | } |
| 156 | |
| 157 | #[repr(C)] |
| 158 | pub union UVec3Cast { |
| 159 | pub ux3: [u32; 3], |
| 160 | pub v3: UVec3, |
| 161 | } |
| 162 | |
| 163 | #[repr(C)] |
| 164 | pub union UVec2Cast { |
| 165 | pub ux2: [u32; 2], |
| 166 | pub v2: UVec2, |
| 167 | } |