#[repr(u8)]
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
pub(crate) enum Alignment {
TopLeft = 0,
TopRight = 1,
BottomLeft = 2,
BottomRight = 3,
BottomCenter = 4,
CenterLeft = 5,
CenterRight = 6,
TopCenter = 7,
Center = 8,
}
static HASH_TO_VALUE: [Option<Alignment>; 504] = [
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
Some(Alignment::TopLeft),
None,
None,
None,
None,
None,
Some(Alignment::CenterLeft),
Some(Alignment::CenterRight),
Some(Alignment::Center),
None,
None,
None,
Some(Alignment::TopLeft),
None,
None,
Some(Alignment::TopRight),
None,
None,
Some(Alignment::BottomCenter),
None,
None,
None,
None,
None,
None,
None,
Some(Alignment::TopLeft),
Some(Alignment::BottomRight),
None,
None,
None,
None,
None,
None,
Some(Alignment::BottomLeft),
None,
None,
None,
None,
None,
Some(Alignment::BottomRight),
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
Some(Alignment::BottomLeft),
None,
None,
None,
None,
Some(Alignment::TopRight),
None,
None,
None,
None,
None,
Some(Alignment::CenterRight),
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
Some(Alignment::TopCenter),
None,
None,
None,
None,
Some(Alignment::TopRight),
None,
None,
None,
None,
None,
None,
Some(Alignment::BottomCenter),
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
Some(Alignment::CenterLeft),
None,
None,
Some(Alignment::CenterRight),
None,
None,
None,
None,
None,
None,
Some(Alignment::TopCenter),
None,
None,
None,
None,
None,
None,
None,
Some(Alignment::Center),
None,
None,
None,
Some(Alignment::TopCenter),
None,
None,
None,
Some(Alignment::BottomCenter),
Some(Alignment::BottomCenter),
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
Some(Alignment::TopRight),
Some(Alignment::CenterLeft),
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
Some(Alignment::BottomCenter),
None,
Some(Alignment::BottomLeft),
None,
None,
None,
None,
None,
None,
Some(Alignment::BottomLeft),
None,
None,
Some(Alignment::BottomCenter),
None,
None,
Some(Alignment::TopRight),
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
Some(Alignment::BottomRight),
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
Some(Alignment::CenterLeft),
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
Some(Alignment::TopLeft),
None,
None,
Some(Alignment::TopCenter),
None,
None,
None,
None,
Some(Alignment::CenterRight),
None,
None,
None,
None,
None,
Some(Alignment::TopRight),
None,
None,
None,
None,
None,
None,
None,
Some(Alignment::TopLeft),
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
Some(Alignment::BottomCenter),
None,
None,
None,
None,
Some(Alignment::BottomLeft),
None,
None,
None,
None,
Some(Alignment::TopLeft),
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
Some(Alignment::BottomRight),
None,
None,
Some(Alignment::CenterRight),
None,
Some(Alignment::CenterLeft),
None,
None,
Some(Alignment::TopLeft),
Some(Alignment::TopRight),
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
Some(Alignment::BottomRight),
None,
None,
Some(Alignment::BottomLeft),
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
Some(Alignment::TopLeft),
None,
None,
Some(Alignment::BottomRight),
None,
None,
Some(Alignment::CenterLeft),
None,
None,
None,
Some(Alignment::CenterRight),
None,
None,
None,
None,
None,
None,
None,
None,
Some(Alignment::TopCenter),
None,
None,
Some(Alignment::BottomRight),
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
Some(Alignment::TopCenter),
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
Some(Alignment::CenterRight),
None,
None,
None,
None,
None,
None,
None,
None,
Some(Alignment::TopRight),
None,
None,
None,
None,
None,
None,
Some(Alignment::TopCenter),
None,
Some(Alignment::BottomRight),
None,
None,
None,
None,
None,
Some(Alignment::BottomLeft),
None,
None,
None,
None,
None,
None,
None,
None,
Some(Alignment::CenterLeft),
None,
None,
None,
Some(Alignment::BottomCenter),
None,
None,
Some(Alignment::BottomLeft),
None,
Some(Alignment::BottomCenter),
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
Some(Alignment::TopCenter),
None,
Some(Alignment::CenterLeft),
None,
None,
None,
None,
None,
Some(Alignment::CenterRight),
None,
None,
None,
None,
None,
];
static HASH_COLISION_VALIDATOR: [u64; 504] = [
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0xE77476927BB1F5BA,
0x0,
0x0,
0x0,
0x0,
0x0,
0x8AD3D07B553FFB8,
0x9304EC8EEA604BC1,
0xAF63DE4C8601EFF2,
0x0,
0x0,
0x0,
0x9DE024B2120B98E6,
0x0,
0x0,
0x39E71F8A62DE5701,
0x0,
0x0,
0xA624A603C0089324,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0xF421F5D455C8ABF4,
0xD507BA43B3756795,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x70368775D0088DAC,
0x0,
0x0,
0x0,
0x0,
0x0,
0x7599DC3C1513C3EA,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0xFB64662C5017F316,
0x0,
0x0,
0x0,
0x0,
0xCE850C53BEF38073,
0x0,
0x0,
0x0,
0x0,
0x0,
0x65396E5B51A502B9,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0xCAAFFC9910500FE6,
0x0,
0x0,
0x0,
0x0,
0x8DC4007B57B7593,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x8A63507B54DD372,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x514DD14DA8C513AA,
0x0,
0x0,
0xAF63EF4C86020CD5,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x56F9BC194465A83C,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x6F4B7EC4DCAA8AC4,
0x0,
0x0,
0x0,
0x8C82D07B56AAC40,
0x0,
0x0,
0x0,
0xC8445BCEEB38F9E4,
0xCBF29CE484222325,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0xA3FCE9FC2CE1927,
0x24B070ADA2041CB0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0xE117B24625D0110A,
0x0,
0xA4221E8E7C22F1DC,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x5F016149CAD46553,
0x0,
0x0,
0x82F126EB66199A6E,
0x0,
0x0,
0xDECCB5F50C693099,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x8A64607B54DF055,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x8A25A07B54A297A,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x8248819F5F9365CD,
0x0,
0x0,
0x647A044389CAB590,
0x0,
0x0,
0x0,
0x0,
0x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0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0xE2A269CD73B21923,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x78AEE42ECD39B9C,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0xAF63E94C860202A3,
0x0,
0x8DC5607B57B9AF5,
0x0,
0x0,
0x0,
0x0,
0x0,
0x8A63807B54DD88B,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x1EFBE181D4855A8C,
0x0,
0x0,
0x0,
0x8A24C07B54A11B0,
0x0,
0x0,
0x8AD3E07B554016B,
0x0,
0xAF63DF4C8601F1A5,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x8A24207B54A00B2,
0x0,
0x7C14C81DD4CC9CC,
0x0,
0x0,
0x0,
0x0,
0x0,
0x8DC5507B57B9942,
0x0,
0x0,
0x0,
0x0,
0x0,
];
impl Alignment {
pub(super) fn from_hash(hash: u64) -> Option<Alignment> {
let entry_index = (hash % 504) as usize;
if HASH_COLISION_VALIDATOR[entry_index] != hash {
return None;
}
HASH_TO_VALUE[entry_index]
}
pub(crate) fn name(&self) -> &'static str {
match self {
Alignment::TopLeft => "TopLeft",
Alignment::TopRight => "TopRight",
Alignment::BottomLeft => "BottomLeft",
Alignment::BottomRight => "BottomRight",
Alignment::BottomCenter => "BottomCenter",
Alignment::CenterLeft => "CenterLeft",
Alignment::CenterRight => "CenterRight",
Alignment::TopCenter => "TopCenter",
Alignment::Center => "Center",
}
}
}