Skip to main content

shift_asr

Function shift_asr 

Source
pub const fn shift_asr(value: u32, shift: u8, carry: bool) -> (u32, bool)
Expand description

ASR (arithmetic shift right, sign-extending) by a register-derived amount 0..=255.

(Mesen2 ShiftAsr.) For shift >= 32 the result is the sign bit smeared across all 32 bits (an ASR by 31 of the original value achieves this — never a literal >> 32); carry-out is the sign bit itself in that case. See shift_lsl for the shared shift == 0 no-op contract.