MIR Shl/Shr: the offset can be computed with rem_euclid

This commit is contained in:
Ralf Jung
2024-06-14 11:28:18 +02:00
parent d2ad293851
commit 669a40006b
2 changed files with 11 additions and 14 deletions

View File

@@ -1490,7 +1490,8 @@ pub enum BinOp {
BitOr,
/// The `<<` operator (shift left)
///
/// The offset is (uniquely) determined as follows:
/// The offset is given by `RHS.rem_euclid(LHS::BITS)`.
/// In other words, it is (uniquely) determined as follows:
/// - it is "equal modulo LHS::BITS" to the RHS
/// - it is in the range `0..LHS::BITS`
Shl,
@@ -1498,7 +1499,8 @@ pub enum BinOp {
ShlUnchecked,
/// The `>>` operator (shift right)
///
/// The offset is (uniquely) determined as follows:
/// The offset is given by `RHS.rem_euclid(LHS::BITS)`.
/// In other words, it is (uniquely) determined as follows:
/// - it is "equal modulo LHS::BITS" to the RHS
/// - it is in the range `0..LHS::BITS`
///