From d0b9e430811006f6c78a397b2359b8c2393b04c5 Mon Sep 17 00:00:00 2001 From: pcw109550 Date: Tue, 18 Feb 2025 16:46:23 +0900 Subject: [PATCH 1/2] fix: swap bytes for `as_le_bytes` --- src/bytes.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bytes.rs b/src/bytes.rs index bc0d04d..5fbed3a 100644 --- a/src/bytes.rs +++ b/src/bytes.rs @@ -60,7 +60,7 @@ impl Uint { return Cow::Owned({ let mut cpy = *self; for limb in &mut cpy.limbs { - *limb = limb.reverse_bits(); + *limb = limb.swap_bytes(); } unsafe { slice::from_raw_parts(cpy.limbs.as_ptr().cast(), Self::BYTES).to_vec() } }); From 7e39a57bac842adf8a6fbce6677bd84372435ccb Mon Sep 17 00:00:00 2001 From: pcw109550 Date: Tue, 18 Feb 2025 16:58:54 +0900 Subject: [PATCH 2/2] Update CHANGELOG --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d56e63..8e6625e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,11 +14,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Unpin proptest ([#426]) - Update documentation related to `Uint::byte` and knuth divison ([#429]) - add `Uint::checked_byte(idx: usize) -> Option` ([#429]) +- fix: swap bytes for `as_le_bytes` in big endian world ([#431]) [#416]: https://github.com/recmo/uint/pull/416 [#424]: https://github.com/recmo/uint/pull/424 [#426]: https://github.com/recmo/uint/pull/426 [#429]: https://github.com/recmo/uint/pull/429 +[#431]: https://github.com/recmo/uint/pull/431 ## [1.12.4] - 2024-12-16