X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=rust%2Fsrc%2Fendian.rs;h=bb63ec518dd832bdc10b069065bb7ce95f33a040;hb=1b75557bce9dc7cd9a146563ac4da39bf5884846;hp=bf861af2d18765697eab1e078f5ff3fd374d43a8;hpb=e09ed2b52e13125dc04a169e192b1cde759ab1e7;p=pspp diff --git a/rust/src/endian.rs b/rust/src/endian.rs index bf861af2d1..bb63ec518d 100644 --- a/rust/src/endian.rs +++ b/rust/src/endian.rs @@ -53,6 +53,14 @@ impl ToBytes for Endian { } } } +impl ToBytes for Endian { + fn to_bytes(self, value: i32) -> [u8; 4] { + match self { + Endian::Big => i32::to_be_bytes(value), + Endian::Little => i32::to_le_bytes(value), + } + } +} impl ToBytes for Endian { fn to_bytes(self, value: u16) -> [u8; 2] { match self {