2021-08-05 22:45:57 -05:00
|
|
|
macro_rules! impl_fmt_trait {
|
|
|
|
{ $($trait:ident,)* } => {
|
2020-09-24 23:44:48 -05:00
|
|
|
$(
|
2021-08-16 15:38:30 -05:00
|
|
|
impl<T, const LANES: usize> core::fmt::$trait for crate::Simd<T, LANES>
|
2021-08-05 22:45:57 -05:00
|
|
|
where
|
|
|
|
crate::LaneCount<LANES>: crate::SupportedLaneCount,
|
2021-08-16 15:38:30 -05:00
|
|
|
T: crate::SimdElement + core::fmt::$trait,
|
2021-08-05 22:45:57 -05:00
|
|
|
{
|
|
|
|
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
|
|
|
|
#[repr(transparent)]
|
|
|
|
struct Wrapper<'a, T: core::fmt::$trait>(&'a T);
|
2020-09-24 23:44:48 -05:00
|
|
|
|
2021-08-05 22:45:57 -05:00
|
|
|
impl<T: core::fmt::$trait> core::fmt::Debug for Wrapper<'_, T> {
|
|
|
|
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
|
|
|
|
self.0.fmt(f)
|
|
|
|
}
|
2020-09-24 23:44:48 -05:00
|
|
|
}
|
|
|
|
|
2021-08-05 22:45:57 -05:00
|
|
|
f.debug_list()
|
|
|
|
.entries(self.as_array().iter().map(|x| Wrapper(x)))
|
|
|
|
.finish()
|
2020-09-24 23:44:48 -05:00
|
|
|
}
|
2021-08-05 22:45:57 -05:00
|
|
|
}
|
2020-09-24 23:44:48 -05:00
|
|
|
)*
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl_fmt_trait! {
|
2021-08-05 22:45:57 -05:00
|
|
|
Debug,
|
|
|
|
Binary,
|
|
|
|
LowerExp,
|
|
|
|
UpperExp,
|
|
|
|
Octal,
|
|
|
|
LowerHex,
|
|
|
|
UpperHex,
|
2020-09-24 23:44:48 -05:00
|
|
|
}
|