#[allow(unused_macros)]
macro_rules! layout {
($t:ty, size = $size:expr, align = $align:expr) => {
const _: () = assert!(
::core::mem::size_of::<$t>() == $size && ::core::mem::align_of::<$t>() == $align,
concat!(
"layout of ",
stringify!($t),
" differs from the platform headers"
),
);
};
}
#[cfg(test)]
#[allow(unused_macros)]
macro_rules! same_layout {
($ours:ty, $theirs:ty $(, $a:ident $(. $an:ident)* => $b:ident $(. $bn:ident)*)* $(,)?) => {
const _: () = {
assert!(::core::mem::size_of::<$ours>() == ::core::mem::size_of::<$theirs>(),
concat!("size of ", stringify!($ours)));
assert!(::core::mem::align_of::<$ours>() == ::core::mem::align_of::<$theirs>(),
concat!("alignment of ", stringify!($ours)));
$(assert!(
::core::mem::offset_of!($ours, $a $(. $an)*)
== ::core::mem::offset_of!($theirs, $b $(. $bn)*),
concat!("offset of ", stringify!($ours), ".", stringify!($a $(. $an)*))
);)*
};
};
(prefix $ours:ty, $theirs:ty $(, $a:ident => $b:ident)* $(,)?) => {
const _: () = {
assert!(::core::mem::size_of::<$ours>() <= ::core::mem::size_of::<$theirs>(),
concat!("size of ", stringify!($ours)));
$(assert!(
::core::mem::offset_of!($ours, $a) == ::core::mem::offset_of!($theirs, $b),
concat!("offset of ", stringify!($ours), ".", stringify!($a))
);)*
};
};
}
#[cfg(all(
any(target_os = "linux", target_os = "android"),
target_pointer_width = "64"
))]
#[allow(unsafe_code)]
mod linux;
#[cfg(all(
any(target_os = "macos", target_os = "ios"),
target_pointer_width = "64"
))]
#[allow(unsafe_code)]
mod apple;
#[cfg(windows)]
#[allow(unsafe_code)]
mod windows;