use std::fmt;
#[derive(PartialEq, PartialOrd, Eq, Ord, Debug)]
pub struct FloatAlignment {
pub size: FloatAlignmentSize,
pub abi: i32,
pub pref: Option<i32>,
}
impl fmt::Display for FloatAlignment {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.pref {
Some(pref) => write!(f, "f{}:{}:{}", self.size, self.abi, pref),
None => write!(f, "f{}:{}", self.size, self.abi),
}
}
}
#[derive(PartialEq, PartialOrd, Eq, Ord, Debug)]
pub enum FloatAlignmentSize {
FLOAT,
DOUBLE,
LONGDOUBLE80,
LONGDOUBLE128,
}
impl fmt::Display for FloatAlignmentSize {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let size = match self {
Self::FLOAT => 32,
Self::DOUBLE => 64,
Self::LONGDOUBLE80 => 80,
Self::LONGDOUBLE128 => 128,
};
write!(f, "{}", size)
}
}