safe_arch/x86_x64/
m512d_.rs1use super::*;
8
9#[repr(transparent)]
15#[allow(non_camel_case_types)]
16pub struct m512d(pub __m512d);
17
18#[cfg(feature = "bytemuck")]
19unsafe impl bytemuck::Zeroable for m512d {}
20#[cfg(feature = "bytemuck")]
21unsafe impl bytemuck::Pod for m512d {}
22#[cfg(feature = "bytemuck")]
23unsafe impl bytemuck::TransparentWrapper<__m512d> for m512d {}
24
25impl m512d {
26 #[must_use]
30 #[inline(always)]
31 pub fn to_array(self) -> [f64; 8] {
32 self.into()
33 }
34
35 #[must_use]
40 #[inline(always)]
41 pub fn from_array(f: [f64; 8]) -> Self {
42 f.into()
43 }
44
45 #[must_use]
51 #[inline(always)]
52 pub fn to_bits(self) -> [u64; 8] {
53 unsafe { core::mem::transmute(self) }
54 }
55
56 #[must_use]
60 #[inline(always)]
61 pub fn from_bits(bits: [u64; 8]) -> Self {
62 unsafe { core::mem::transmute(bits) }
63 }
64}
65
66impl Clone for m512d {
67 #[inline(always)]
68 fn clone(&self) -> Self {
69 *self
70 }
71}
72impl Copy for m512d {}
73
74impl Default for m512d {
75 #[inline(always)]
76 fn default() -> Self {
77 unsafe { core::mem::zeroed() }
78 }
79}
80
81impl From<[f64; 8]> for m512d {
82 #[inline(always)]
83 fn from(arr: [f64; 8]) -> Self {
84 unsafe { core::mem::transmute(arr) }
88 }
89}
90
91impl From<m512d> for [f64; 8] {
92 #[inline(always)]
93 fn from(m: m512d) -> Self {
94 unsafe { core::mem::transmute(m) }
96 }
97}
98
99impl Debug for m512d {
104 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
111 write!(f, "m512d(")?;
112 for (i, double) in self.to_array().iter().enumerate() {
113 if i != 0 {
114 write!(f, ", ")?;
115 }
116 Debug::fmt(double, f)?;
117 }
118 write!(f, ")")
119 }
120}
121
122impl Display for m512d {
123 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
130 write!(f, "(")?;
131 for (i, double) in self.to_array().iter().enumerate() {
132 if i != 0 {
133 write!(f, ", ")?;
134 }
135 Display::fmt(double, f)?;
136 }
137 write!(f, ")")
138 }
139}
140
141impl Binary for m512d {
142 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
149 write!(f, "(")?;
150 for (i, double) in self.to_array().iter().enumerate() {
151 if i != 0 {
152 write!(f, ", ")?;
153 }
154 Binary::fmt(&double.to_bits(), f)?;
155 }
156 write!(f, ")")
157 }
158}
159
160impl LowerExp for m512d {
161 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
168 write!(f, "(")?;
169 for (i, double) in self.to_array().iter().enumerate() {
170 if i != 0 {
171 write!(f, ", ")?;
172 }
173 LowerExp::fmt(double, f)?;
174 }
175 write!(f, ")")
176 }
177}
178
179impl UpperExp for m512d {
180 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
187 write!(f, "(")?;
188 for (i, double) in self.to_array().iter().enumerate() {
189 if i != 0 {
190 write!(f, ", ")?;
191 }
192 UpperExp::fmt(double, f)?;
193 }
194 write!(f, ")")
195 }
196}
197
198impl LowerHex for m512d {
199 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
206 write!(f, "(")?;
207 for (i, double) in self.to_array().iter().enumerate() {
208 if i != 0 {
209 write!(f, ", ")?;
210 }
211 LowerHex::fmt(&double.to_bits(), f)?;
212 }
213 write!(f, ")")
214 }
215}
216
217impl UpperHex for m512d {
218 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
225 write!(f, "(")?;
226 for (i, double) in self.to_array().iter().enumerate() {
227 if i != 0 {
228 write!(f, ", ")?;
229 }
230 UpperHex::fmt(&double.to_bits(), f)?;
231 }
232 write!(f, ")")
233 }
234}
235
236impl Octal for m512d {
237 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
244 write!(f, "(")?;
245 for (i, double) in self.to_array().iter().enumerate() {
246 if i != 0 {
247 write!(f, ", ")?;
248 }
249 Octal::fmt(&double.to_bits(), f)?;
250 }
251 write!(f, ")")
252 }
253}