1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
pub enum ELFVERSION {
    // value must be 1
    VERSIONCURRENT,

    // for architecture-specific-value
    ANY(u8),
}

impl ELFVERSION {
    pub fn to_identifier(&self) -> u128 {
        let byte = match self {
            Self::VERSIONCURRENT => 1,
            Self::ANY(c) => *c,
        };
        Self::shift_position(byte)
    }
    fn shift_position(byte: u8) -> u128 {
        (byte as u128) << 72
    }
}