use super::MODEL_LEN;
use super::PREFIX_LEN;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Model(pub u8);
impl Model {
const LZP: u8 = 0x02;
const RLE: u8 = 0x04;
#[inline]
pub const fn has_lzp(self) -> bool {
self.0 & Self::LZP != 0
}
#[inline]
pub const fn has_rle(self) -> bool {
self.0 & Self::RLE != 0
}
#[inline]
pub const fn set_lzp(&mut self) {
self.0 |= Self::LZP;
}
#[inline]
pub const fn set_rle(&mut self) {
self.0 |= Self::RLE;
}
pub const fn header_len(self) -> usize {
let mut len = PREFIX_LEN + MODEL_LEN;
if self.has_lzp() {
len += 4;
}
if self.has_rle() {
len += 4;
}
len
}
}