#[doc(hidden)]
#[macro_export]
macro_rules! len {
{ } => {
0
};
{ $last:tt } => {
$last + 1
};
{ $first:tt $( $rest:tt )+ } => {
$crate::len! { $( $rest )+ }
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! size {
{ $ty:ty } => {
{
const SIZE: usize = <$ty>::BYTES;
if SIZE == 0 { 0 } else { SIZE.next_power_of_two() }
}
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! max {
{ } => {
0
};
{ $val:expr ; } => {
$val
};
{ $first:expr ; $( $rest:expr ; )+ } => {
{
const REST: usize = $crate::max! { $( $rest ; )+ };
if $first > REST { $first } else { REST }
}
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! max_size {
{ $( $ty:ty )* } => {
$crate::max! { $( $crate::size! { $ty } ; )* }
};
}