blob: 649ba17c54f1813e58e7af9d47902a529eaa36d4 [file] [log] [blame] [edit]
/// A simple macro for defining bitfield accessors/mutators.
#[cfg(feature = "alloc")]
macro_rules! define_bool {
($bit:expr, $is_fn_name:ident, $set_fn_name:ident) => {
fn $is_fn_name(&self) -> bool {
self.bools & (0b1 << $bit) > 0
}
fn $set_fn_name(&mut self, yes: bool) {
if yes {
self.bools |= 1 << $bit;
} else {
self.bools &= !(1 << $bit);
}
}
};
}
macro_rules! log {
($($tt:tt)*) => {
#[cfg(feature = "logging")]
{
$($tt)*
}
}
}
macro_rules! trace {
($($tt:tt)*) => { log!(log::trace!($($tt)*)) }
}