projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
all the header records have parsers
[pspp]
/
rust
/
src
/
endian.rs
diff --git
a/rust/src/endian.rs
b/rust/src/endian.rs
index bf861af2d18765697eab1e078f5ff3fd374d43a8..bb63ec518dd832bdc10b069065bb7ce95f33a040 100644
(file)
--- a/
rust/src/endian.rs
+++ b/
rust/src/endian.rs
@@
-53,6
+53,14
@@
impl ToBytes<u32, 4> for Endian {
}
}
}
}
}
}
+impl ToBytes<i32, 4> 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<u16, 2> for Endian {
fn to_bytes(self, value: u16) -> [u8; 2] {
match self {
impl ToBytes<u16, 2> for Endian {
fn to_bytes(self, value: u16) -> [u8; 2] {
match self {