#[repr(u8)]
#[derive(Copy,Clone,PartialEq, Debug)]
pub(crate) enum Alignament {
TopLeft = 0,
Top,
TopRight,
Right,
BottomRight,
Bottom,
BottomLeft,
Left,
Center,
}
static HASH_TO_ALIGNAMENT: [Option<Alignament>; 95] = [
None,
None,
None,
Some(Alignament::BottomLeft),
None,
None,
None,
Some(Alignament::TopRight),
None,
None,
Some(Alignament::TopRight),
None,
None,
Some(Alignament::Center),
Some(Alignament::BottomLeft),
None,
None,
None,
None,
None,
None,
None,
Some(Alignament::BottomLeft),
Some(Alignament::TopLeft),
None,
None,
None,
None,
None,
Some(Alignament::Right),
None,
Some(Alignament::TopLeft),
Some(Alignament::Left),
None,
Some(Alignament::Top),
Some(Alignament::Top),
Some(Alignament::Left),
None,
None,
Some(Alignament::BottomRight),
None,
None,
None,
None,
None,
Some(Alignament::TopLeft),
None,
None,
None,
Some(Alignament::BottomRight),
None,
None,
Some(Alignament::TopRight),
None,
Some(Alignament::BottomRight),
None,
None,
None,
Some(Alignament::TopLeft),
None,
None,
None,
Some(Alignament::Center),
None,
None,
Some(Alignament::BottomRight),
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
Some(Alignament::Right),
None,
None,
None,
Some(Alignament::Bottom),
None,
None,
None,
Some(Alignament::Bottom),
Some(Alignament::TopRight),
Some(Alignament::BottomLeft),
None,
None,
None,
None,
];
static HASH_COLISION_VALIDATOR: [u64; 95] = [
0x0,
0x0,
0x0,
0x8AD3E07B554016B,
0x0,
0x0,
0x0,
0x8DC4007B57B7593,
0x0,
0x0,
0x8C83E07B56AC923,
0x0,
0x0,
0xAF63DE4C8601EFF2,
0x5F016149CAD46553,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0xC531399B902BDCA7,
0x8248819F5F9365CD,
0x0,
0x0,
0x0,
0x0,
0x0,
0x76AAAA535714D805,
0x0,
0xD3AB2E45320FD0B,
0x24B070ADA2041CB0,
0x0,
0xAF63E94C860202A3,
0x56F9BC194465A83C,
0xAF63E14C8601F50B,
0x0,
0x0,
0x8A64607B54DF055,
0x0,
0x0,
0x0,
0x0,
0x0,
0x8AD5407B55426CD,
0x0,
0x0,
0x0,
0x8DC5607B57B9AF5,
0x0,
0x0,
0x78AEE42ECD39B9C,
0x0,
0x7599DC3C1513C3EA,
0x0,
0x0,
0x0,
0x8C83C07B56AC5BD,
0x0,
0x0,
0x0,
0x6F4B7EC4DCAA8AC4,
0x0,
0x0,
0x1396C5DBB548C758,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0xAF63EF4C86020CD5,
0x0,
0x0,
0x0,
0xAF63DF4C8601F1A5,
0x0,
0x0,
0x0,
0xE117B24625D0110A,
0xB58CAB573F8DB2C6,
0x8A63807B54DD88B,
0x0,
0x0,
0x0,
0x0,
];
impl Alignament {
pub(super) fn from_hash(hash: u64) -> Option<Alignament> {
let entry_index = (hash % 95) as usize;
if HASH_COLISION_VALIDATOR[entry_index] != hash {
return None;
}
HASH_TO_ALIGNAMENT[entry_index]
}
}