use core::ops::BitOr;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum Direction {
Forward,
Backward,
}
impl Direction {
#[must_use]
pub const fn sign(self) -> i32 {
match self {
Self::Forward => -1,
Self::Backward => 1,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub struct Flags(u32);
impl Flags {
pub const ESTIMATE: Self = Self(0);
pub const MEASURE: Self = Self(1 << 0);
pub const PATIENT: Self = Self(1 << 1);
pub const EXHAUSTIVE: Self = Self(1 << 2);
pub const PRESERVE_INPUT: Self = Self(1 << 3);
pub const DESTROY_INPUT: Self = Self(1 << 4);
pub const UNALIGNED: Self = Self(1 << 5);
#[must_use]
pub const fn is_measure(self) -> bool {
self.0 & Self::MEASURE.0 != 0
}
#[must_use]
pub const fn is_patient(self) -> bool {
self.0 & Self::PATIENT.0 != 0
}
#[must_use]
pub const fn is_exhaustive(self) -> bool {
self.0 & Self::EXHAUSTIVE.0 != 0
}
#[must_use]
pub const fn can_destroy_input(self) -> bool {
self.0 & Self::DESTROY_INPUT.0 != 0
}
}
impl BitOr for Flags {
type Output = Self;
fn bitor(self, rhs: Self) -> Self::Output {
Self(self.0 | rhs.0)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum R2rKind {
DctI,
DctII,
DctIII,
DctIV,
DstI,
DstII,
DstIII,
DstIV,
Dht,
Hc2r,
R2hc,
}