Skip to content

Commit b068908

Browse files
Use u64::to_le
Co-authored-by: Simon Sapin <simon.sapin@exyr.org>
1 parent 0ceca1f commit b068908

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

src/atom.rs

+1-12
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,7 @@ impl<Static> Atom<Static> {
103103
#[inline(always)]
104104
#[doc(hidden)]
105105
pub const fn pack_inline(n: u64, len: u8) -> Self {
106-
// Reverse byte order if big-endian
107-
let n = if cfg!(target_endian = "big") {
108-
((n & 0x000000000000FF00) << 48)
109-
| ((n & 0x0000000000FF0000) << 32)
110-
| ((n & 0x00000000FF000000) << 16)
111-
| (n & 0x000000FF00000000)
112-
| ((n & 0x0000FF0000000000) >> 16)
113-
| ((n & 0x00FF000000000000) >> 32)
114-
| ((n & 0xFF00000000000000) >> 48)
115-
} else {
116-
n
117-
};
106+
let n = n.to_le();
118107

119108
let data: u64 = (INLINE_TAG as u64) | ((len as u64) << LEN_OFFSET) | n;
120109
Self {

0 commit comments

Comments
 (0)