Skip to main content

rotate_right_carry

Function rotate_right_carry 

Source
pub const fn rotate_right_carry(
    value: u32,
    shift: u32,
    carry_in: bool,
) -> (u32, bool)
Expand description

ROR by a 0..=31 amount, also returning the carry-out (bit shift-1 of value) — Mesen2’s 3-argument RotateRight, used by ArmDataProcessing’s immediate-operand rotate.

Every current call site only ever passes a nonzero shift (the immediate encodings derive it as nibble * 2 from a nonzero nibble, matching rotate_right’s own contract), but this is a public helper, so shift == 0 is handled safely and total rather than left to underflow shift - 1: it returns carry_in unchanged, matching every other shift function in this module’s shared “shift 0 preserves the existing carry” contract (see shift_lsl).