Skip to content

Commit 15dd907

Browse files
authored
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 .
2 parents 444a32e + eff7d56 commit 15dd907

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

library/core/src/num/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -4383,8 +4383,8 @@ assert_eq!(
43834383
}
43844384

43854385
doc_comment! {
4386-
concat!("Create an integer value from its representation as a byte array in
4387-
big endian.
4386+
concat!("Create a native endian integer value from its representation
4387+
as a byte array in big endian.
43884388
",
43894389
$from_xe_bytes_doc,
43904390
"
@@ -4416,8 +4416,8 @@ fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT),
44164416

44174417
doc_comment! {
44184418
concat!("
4419-
Create an integer value from its representation as a byte array in
4420-
little endian.
4419+
Create a native endian integer value from its representation
4420+
as a byte array in little endian.
44214421
",
44224422
$from_xe_bytes_doc,
44234423
"
@@ -4448,8 +4448,8 @@ fn read_le_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT),
44484448
}
44494449

44504450
doc_comment! {
4451-
concat!("Create an integer value from its memory representation as a byte
4452-
array in native endianness.
4451+
concat!("Create a native endian integer value from its memory representation
4452+
as a byte array in native endianness.
44534453
44544454
As the target platform's native endianness is used, portable code
44554455
likely wants to use [`from_be_bytes`] or [`from_le_bytes`], as

0 commit comments

Comments
 (0)