Use [u8; 16] to avoid number alignment bumps

This commit is contained in:
Richard Feldman 2022-05-21 00:29:41 -04:00
parent 0d51443575
commit 49aea9d639
No known key found for this signature in database
GPG key ID: 7E4127D1E4241798
20 changed files with 154 additions and 109 deletions

View file

@ -50,15 +50,15 @@ impl Output {
#[derive(Clone, Debug, PartialEq)]
pub enum IntValue {
I128(i128),
U128(u128),
I128([u8; 16]),
U128([u8; 16]),
}
impl Display for IntValue {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
IntValue::I128(n) => Display::fmt(&n, f),
IntValue::U128(n) => Display::fmt(&n, f),
IntValue::I128(n) => Display::fmt(&i128::from_ne_bytes(*n), f),
IntValue::U128(n) => Display::fmt(&u128::from_ne_bytes(*n), f),
}
}
}