diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2020-08-07 09:35:26 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-07 09:35:26 +0900 |
| commit | 26705d5bcb2430ef7e8b491b5ec9ede4ef5b460b (patch) | |
| tree | ebbc7bce541fb619699f63f12f3c977f4864e8c6 | |
| parent | 19d4e1dcacd8594b05816f1193ca67686aad7998 (diff) | |
| parent | eff7d568d820a07d621bac85502d6236103ca908 (diff) | |
| download | rust-26705d5bcb2430ef7e8b491b5ec9ede4ef5b460b.tar.gz rust-26705d5bcb2430ef7e8b491b5ec9ede4ef5b460b.zip | |
Rollup merge of #75211 - lzutao:native-endian-notes, r=lcnr
Note about endianness of returned value of {integer}::from_be_bytes and friends
[`u32::from_be`](https://doc.rust-lang.org/nightly/src/core/num/mod.rs.html#2883-2892) documents about endianness of returned value.
I was confused by endianness of `from_be_bytes` in #75086 .
| -rw-r--r-- | library/core/src/num/mod.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/library/core/src/num/mod.rs b/library/core/src/num/mod.rs index eb50dc28b9f..95eae7e2a73 100644 --- a/library/core/src/num/mod.rs +++ b/library/core/src/num/mod.rs @@ -4383,8 +4383,8 @@ assert_eq!( } doc_comment! { - concat!("Create an integer value from its representation as a byte array in -big endian. + concat!("Create a native endian integer value from its representation +as a byte array in big endian. ", $from_xe_bytes_doc, " @@ -4416,8 +4416,8 @@ fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), doc_comment! { concat!(" -Create an integer value from its representation as a byte array in -little endian. +Create a native endian integer value from its representation +as a byte array in little endian. ", $from_xe_bytes_doc, " @@ -4448,8 +4448,8 @@ fn read_le_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), } doc_comment! { - concat!("Create an integer value from its memory representation as a byte -array in native endianness. + concat!("Create a native endian integer value from its memory representation +as a byte array in native endianness. As the target platform's native endianness is used, portable code likely wants to use [`from_be_bytes`] or [`from_le_bytes`], as |
