mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Rollup merge of #125137 - RalfJung:mir-sh, r=scottmcm
MIR operators: clarify Shl/Shr handling of negative offsets "made unsigned" was not fully clear (made unsigned how? by using `abs`? no), so let's say "re-interpreted as an unsigned value of the same size" instead. r? `@scottmcm`
This commit is contained in:
commit
8d38f2fb11
@ -1480,13 +1480,17 @@ pub enum BinOp {
|
||||
BitOr,
|
||||
/// The `<<` operator (shift left)
|
||||
///
|
||||
/// The offset is truncated to the size of the first operand and made unsigned before shifting.
|
||||
/// The offset is (uniquely) determined as follows:
|
||||
/// - it is "equal modulo LHS::BITS" to the RHS
|
||||
/// - it is in the range `0..LHS::BITS`
|
||||
Shl,
|
||||
/// Like `Shl`, but is UB if the RHS >= LHS::BITS or RHS < 0
|
||||
ShlUnchecked,
|
||||
/// The `>>` operator (shift right)
|
||||
///
|
||||
/// The offset is truncated to the size of the first operand and made unsigned before shifting.
|
||||
/// The offset is (uniquely) determined as follows:
|
||||
/// - it is "equal modulo LHS::BITS" to the RHS
|
||||
/// - it is in the range `0..LHS::BITS`
|
||||
///
|
||||
/// This is an arithmetic shift if the LHS is signed
|
||||
/// and a logical shift if the LHS is unsigned.
|
||||
|
Loading…
Reference in New Issue
Block a user