Skip to content

Commit

Permalink
Add Mdf::ordinal and Mdf::year_flags
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker committed Jan 26, 2024
1 parent 8d7a6b2 commit 54da8d1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/naive/internals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,20 @@ impl Mdf {
pub(super) const fn to_of(&self) -> Option<Of> {
Of::from_mdf(*self)
}

#[inline]
pub(super) const fn ordinal(&self) -> Option<u32> {
let mdl = self.0 >> 3;
match MDL_TO_OL[mdl as usize] {
XX => None,
v => Some((mdl - v as i32 as u32) >> 1),
}
}

#[inline]
pub(super) const fn year_flags(&self) -> YearFlags {
YearFlags((self.0 & 0b1111) as u8)
}
}

impl fmt::Debug for Mdf {
Expand Down

0 comments on commit 54da8d1

Please sign in to comment.