#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u32)]
pub enum AuditArchitecture
{
AARCH64 = Self::AARCH64_,
ALPHA = Self::ALPHA_,
ARCOMPACT = Self::ARCOMPACT_,
ARCOMPACTBE = Self::ARCOMPACTBE_,
ARCV2 = Self::ARCV2_,
ARCV2BE = Self::ARCV2BE_,
ARM = Self::ARM_,
ARMEB = Self::ARMEB_,
C6X = Self::C6X_,
C6XBE = Self::C6XBE_,
CRIS = Self::CRIS_,
CSKY = Self::CSKY_,
FRV = Self::FRV_,
H8300 = Self::H8300_,
HEXAGON = Self::HEXAGON_,
I386 = Self::I386_,
IA64 = Self::IA64_,
M32R = Self::M32R_,
M68K = Self::M68K_,
MICROBLAZE = Self::MICROBLAZE_,
MIPS = Self::MIPS_,
MIPSEL = Self::MIPSEL_,
MIPS64 = Self::MIPS64_,
MIPS64N32 = Self::MIPS64N32_,
MIPSEL64 = Self::MIPSEL64_,
MIPSEL64N32 = Self::MIPSEL64N32_,
NDS32 = Self::NDS32_,
NDS32BE = Self::NDS32BE_,
NIOS2 = Self::NIOS2_,
OPENRISC = Self::OPENRISC_,
PARISC = Self::PARISC_,
PARISC64 = Self::PARISC64_,
PPC = Self::PPC_,
PPC64 = Self::PPC64_,
PPC64LE = Self::PPC64LE_,
RISCV32 = Self::RISCV32_,
RISCV64 = Self::RISCV64_,
S390 = Self::S390_,
S390X = Self::S390X_,
SH = Self::SH_,
SHEL = Self::SHEL_,
SH64 = Self::SH64_,
SHEL64 = Self::SHEL64_,
SPARC = Self::SPARC_,
SPARC64 = Self::SPARC64_,
TILEGX = Self::TILEGX_,
TILEGX32 = Self::TILEGX32_,
TILEPRO = Self::TILEPRO_,
UNICORE = Self::UNICORE_,
X86_64 = Self::X86_64_,
XTENSA = Self::XTENSA_,
}
impl TryFrom<u32> for AuditArchitecture
{
type Error = ParseNumberError;
#[inline(always)]
fn try_from(value: u32) -> Result<Self, Self::Error>
{
use self::AuditArchitecture::*;
match value
{
Self::AARCH64_ => Ok(AARCH64),
Self::ALPHA_ => Ok(ALPHA),
Self::ARCOMPACT_ => Ok(ARCOMPACT),
Self::ARCOMPACTBE_ => Ok(ARCOMPACTBE),
Self::ARCV2_ => Ok(ARCV2),
Self::ARCV2BE_ => Ok(ARCV2BE),
Self::ARM_ => Ok(ARM),
Self::ARMEB_ => Ok(ARMEB),
Self::C6X_ => Ok(C6X),
Self::C6XBE_ => Ok(C6XBE),
Self::CRIS_ => Ok(CRIS),
Self::CSKY_ => Ok(CSKY),
Self::FRV_ => Ok(FRV),
Self::H8300_ => Ok(H8300),
Self::HEXAGON_ => Ok(HEXAGON),
Self::I386_ => Ok(I386),
Self::IA64_ => Ok(IA64),
Self::M32R_ => Ok(M32R),
Self::M68K_ => Ok(M68K),
Self::MICROBLAZE_ => Ok(MICROBLAZE),
Self::MIPS_ => Ok(MIPS),
Self::MIPSEL_ => Ok(MIPSEL),
Self::MIPS64_ => Ok(MIPS64),
Self::MIPS64N32_ => Ok(MIPS64N32),
Self::MIPSEL64_ => Ok(MIPSEL64),
Self::MIPSEL64N32_ => Ok(MIPSEL64N32),
Self::NDS32_ => Ok(NDS32),
Self::NDS32BE_ => Ok(NDS32BE),
Self::NIOS2_ => Ok(NIOS2),
Self::OPENRISC_ => Ok(OPENRISC),
Self::PARISC_ => Ok(PARISC),
Self::PARISC64_ => Ok(PARISC64),
Self::PPC_ => Ok(PPC),
Self::PPC64_ => Ok(PPC64),
Self::PPC64LE_ => Ok(PPC64LE),
Self::RISCV32_ => Ok(RISCV32),
Self::RISCV64_ => Ok(RISCV64),
Self::S390_ => Ok(S390),
Self::S390X_ => Ok(S390X),
Self::SH_ => Ok(SH),
Self::SHEL_ => Ok(SHEL),
Self::SH64_ => Ok(SH64),
Self::SHEL64_ => Ok(SHEL64),
Self::SPARC_ => Ok(SPARC),
Self::SPARC64_ => Ok(SPARC64),
Self::TILEGX_ => Ok(TILEGX),
Self::TILEGX32_ => Ok(TILEGX32),
Self::TILEPRO_ => Ok(TILEPRO),
Self::UNICORE_ => Ok(UNICORE),
Self::X86_64_ => Ok(X86_64),
Self::XTENSA_ => Ok(XTENSA),
_ => Err(ParseNumberError::OutOfRange)
}
}
}
impl AuditArchitecture
{
#[inline(always)]
pub const fn is_sixty_four_bit(self) -> bool
{
(self as u32) & Self::SixtyFourBit != 0
}
#[inline(always)]
pub const fn is_little_endian(self) -> bool
{
(self as u32) & Self::LittleEndian != 0
}
#[inline(always)]
pub const fn has_mips_n32_convention(self) -> bool
{
(self as u32) & Self::CONVENTION_MIPS64_N32 != 0
}
#[inline(always)]
pub const fn elf_machine(self) -> ElfMachine
{
unsafe { transmute(((self as u32) & 0x0000_FFFF) as u16) }
}
#[inline(always)]
pub(crate) fn optional_architecture(architecture: u32) -> Option<Self>
{
if architecture == 0
{
None
}
else
{
AuditArchitecture::try_from(architecture).ok()
}
}
const SixtyFourBit: u32 = 0x80000000;
const LittleEndian: u32 = 0x40000000;
const CONVENTION_MIPS64_N32: u32 = 0x20000000;
const AARCH64_: u32 = ElfMachine::AARCH64 as u16 as u32 | Self::SixtyFourBit | Self::LittleEndian;
const ALPHA_: u32 = ElfMachine::ALPHA as u16 as u32 | Self::SixtyFourBit | Self::LittleEndian;
const ARCOMPACT_: u32 = ElfMachine::ARCOMPACT as u16 as u32 | Self::LittleEndian;
const ARCOMPACTBE_: u32 = ElfMachine::ARCOMPACT as u16 as u32;
const ARCV2_: u32 = ElfMachine::ARCV2 as u16 as u32 | Self::LittleEndian;
const ARCV2BE_: u32 = ElfMachine::ARCV2 as u16 as u32;
const ARM_: u32 = ElfMachine::ARM as u16 as u32 | Self::LittleEndian;
const ARMEB_: u32 = ElfMachine::ARM as u16 as u32;
const C6X_: u32 = ElfMachine::TI_C6000 as u16 as u32 | Self::LittleEndian;
const C6XBE_: u32 = ElfMachine::TI_C6000 as u16 as u32;
const CRIS_: u32 = ElfMachine::CRIS as u16 as u32 | Self::LittleEndian;
const CSKY_: u32 = ElfMachine::CSKY as u16 as u32 | Self::LittleEndian;
const FRV_: u32 = ElfMachine::FRV as u16 as u32;
const H8300_: u32 = ElfMachine::H8_300 as u16 as u32;
const HEXAGON_: u32 = ElfMachine::HEXAGON as u16 as u32;
const I386_: u32 = ElfMachine::_386 as u16 as u32 | Self::LittleEndian;
const IA64_: u32 = ElfMachine::IA_64 as u16 as u32 | Self::SixtyFourBit | Self::LittleEndian;
const M32R_: u32 = ElfMachine::M32R as u16 as u32;
const M68K_: u32 = ElfMachine::_68K as u16 as u32;
const MICROBLAZE_: u32 = ElfMachine::MICROBLAZE as u16 as u32;
const MIPS_: u32 = ElfMachine::MIPS as u16 as u32;
const MIPSEL_: u32 = ElfMachine::MIPS as u16 as u32 | Self::LittleEndian;
const MIPS64_: u32 = ElfMachine::MIPS as u16 as u32 | Self::SixtyFourBit;
const MIPS64N32_: u32 = ElfMachine::MIPS as u16 as u32 | Self::SixtyFourBit | Self::CONVENTION_MIPS64_N32;
const MIPSEL64_: u32 = ElfMachine::MIPS as u16 as u32 | Self::SixtyFourBit | Self::LittleEndian;
const MIPSEL64N32_: u32 = ElfMachine::MIPS as u16 as u32 | Self::SixtyFourBit | Self::LittleEndian | Self::CONVENTION_MIPS64_N32;
const NDS32_: u32 = ElfMachine::NDS32 as u16 as u32 | Self::LittleEndian;
const NDS32BE_: u32 = ElfMachine::NDS32 as u16 as u32;
const NIOS2_: u32 = ElfMachine::ALTERA_NIOS2 as u16 as u32 | Self::LittleEndian;
const OPENRISC_: u32 = ElfMachine::OPENRISC as u16 as u32;
const PARISC_: u32 = ElfMachine::PARISC as u16 as u32;
const PARISC64_: u32 = ElfMachine::PARISC as u16 as u32 | Self::SixtyFourBit;
const PPC_: u32 = ElfMachine::PPC as u16 as u32;
const PPC64_: u32 = ElfMachine::PPC64 as u16 as u32 | Self::SixtyFourBit;
const PPC64LE_: u32 = ElfMachine::PPC64 as u16 as u32 | Self::SixtyFourBit | Self::LittleEndian;
const RISCV32_: u32 = ElfMachine::RISCV as u16 as u32 | Self::LittleEndian;
const RISCV64_: u32 = ElfMachine::RISCV as u16 as u32 | Self::SixtyFourBit | Self::LittleEndian;
const S390_: u32 = ElfMachine::S390 as u16 as u32;
const S390X_: u32 = ElfMachine::S390 as u16 as u32 | Self::SixtyFourBit;
const SH_: u32 = ElfMachine::SH as u16 as u32;
const SHEL_: u32 = ElfMachine::SH as u16 as u32 | Self::LittleEndian;
const SH64_: u32 = ElfMachine::SH as u16 as u32 | Self::SixtyFourBit;
const SHEL64_: u32 = ElfMachine::SH as u16 as u32 | Self::SixtyFourBit | Self::LittleEndian;
const SPARC_: u32 = ElfMachine::SPARC as u16 as u32;
const SPARC64_: u32 = ElfMachine::SPARCV9 as u16 as u32 | Self::SixtyFourBit;
const TILEGX_: u32 = ElfMachine::TILEGX as u16 as u32 | Self::SixtyFourBit | Self::LittleEndian;
const TILEGX32_: u32 = ElfMachine::TILEGX as u16 as u32 | Self::LittleEndian;
const TILEPRO_: u32 = ElfMachine::TILEPRO as u16 as u32 | Self::LittleEndian;
const UNICORE_: u32 = ElfMachine::UNICORE as u16 as u32 | Self::LittleEndian;
const X86_64_: u32 = ElfMachine::X86_64 as u16 as u32 | Self::SixtyFourBit | Self::LittleEndian;
const XTENSA_: u32 = ElfMachine::XTENSA as u16 as u32;
}