Skip to content

Commit 8d5dcf9

Browse files
committed
Note rotate_{left,right} in wrapping_sh{lr} docs
1 parent 523fa13 commit 8d5dcf9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/libcore/num/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,13 @@ macro_rules! int_impl {
741741
/// where `mask` removes any high-order bits of `rhs` that
742742
/// would cause the shift to exceed the bitwidth of the type.
743743
///
744+
/// Note that this is *not* the same as a rotate-left; the
745+
/// RHS of a wrapping shift-left is restricted to the range
746+
/// of the type, rather than the bits shifted out of the LHS
747+
/// being returned to the other end. The primitive integer
748+
/// types all implement a `rotate_left` function, which may
749+
/// be what you want instead.
750+
///
744751
/// # Examples
745752
///
746753
/// Basic usage:
@@ -759,6 +766,13 @@ macro_rules! int_impl {
759766
/// where `mask` removes any high-order bits of `rhs` that
760767
/// would cause the shift to exceed the bitwidth of the type.
761768
///
769+
/// Note that this is *not* the same as a rotate-right; the
770+
/// RHS of a wrapping shift-right is restricted to the range
771+
/// of the type, rather than the bits shifted out of the LHS
772+
/// being returned to the other end. The primitive integer
773+
/// types all implement a `rotate_right` function, which may
774+
/// be what you want instead.
775+
///
762776
/// # Examples
763777
///
764778
/// Basic usage:

0 commit comments

Comments
 (0)