Skip to content

Commit 8f70cad

Browse files
authored
Rollup merge of #78730 - kornelski:not-inverse, r=Dylan-DPC
Expand explanation of reverse_bits Original documentation only rephrased the function name
2 parents 707988a + 340c94a commit 8f70cad

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

library/core/src/num/int_macros.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,8 @@ assert_eq!(m, ", $swapped, ");
274274
}
275275

276276
doc_comment! {
277-
concat!("Reverses the bit pattern of the integer.
277+
concat!("Reverses the order of bits in the integer. The least significant bit becomes the most significant bit,
278+
second least-significant bit becomes second most-significant bit, etc.
278279
279280
# Examples
280281
@@ -285,6 +286,7 @@ let n = ", $swap_op, stringify!($SelfT), ";
285286
let m = n.reverse_bits();
286287
287288
assert_eq!(m, ", $reversed, ");
289+
assert_eq!(0, 0", stringify!($SelfT), ".reverse_bits());
288290
```"),
289291
#[stable(feature = "reverse_bits", since = "1.37.0")]
290292
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]

library/core/src/num/uint_macros.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ assert_eq!(m, ", $swapped, ");
272272
}
273273

274274
doc_comment! {
275-
concat!("Reverses the bit pattern of the integer.
275+
concat!("Reverses the order of bits in the integer. The least significant bit becomes the most significant bit,
276+
second least-significant bit becomes second most-significant bit, etc.
276277
277278
# Examples
278279
@@ -283,6 +284,7 @@ let n = ", $swap_op, stringify!($SelfT), ";
283284
let m = n.reverse_bits();
284285
285286
assert_eq!(m, ", $reversed, ");
287+
assert_eq!(0, 0", stringify!($SelfT), ".reverse_bits());
286288
```"),
287289
#[stable(feature = "reverse_bits", since = "1.37.0")]
288290
#[rustc_const_stable(feature = "const_math", since = "1.32.0")]

0 commit comments

Comments
 (0)