fn rem(cpu: &mut Cpu, _addr: u64, word: u32) -> Result<(), Trap> {
    let o = parse_type_r(word);
    let numerator = cpu.x[o.rs1 as usize];
    let denominator = cpu.x[o.rs2 as usize];
    cpu.x[o.rd as usize] = signed(
        cpu,
        match denominator {
            0 => numerator,
            _ => cpu.x[o.rs1 as usize].wrapping_rem(cpu.x[o.rs2 as usize]),
        },
    );
    Ok(())
}
/// [rem rd,rs1,rs2]
/// REM and REMU provide the remainder of the corresponding division operation.
/// For REM, the sign of the result equals the sign of the dividend.
[rem rd,rs1,rs2]
REM and REMU provide the remainder of the corresponding division operation.
For REM, the sign of the result equals the sign of the dividend.
[ rem rd rs1 rs2 ] REM and REMU provide the remainder of the corresponding division operation . For REM the sign of the result equals the sign of the dividend .
fn rem(cpu: &mut Cpu, _addr: u64, word: u32) -> Result<(), Trap> {
    let o = parse_type_r(word);
    let numerator = cpu.x[o.rs1 as usize];
    let denominator = cpu.x[o.rs2 as usize];
    cpu.x[o.rd as usize] = signed(
        cpu,
        match denominator {
            0 => numerator,
            _ => cpu.x[o.rs1 as usize].wrapping_rem(cpu.x[o.rs2 as usize]),
        },
    );
    Ok(())
}
fn rem ( cpu : & mut Cpu , _addr : u64 , word : u32 ) -> Result < ( ) , Trap > { let o = parse_type_r ( word ) ; let numerator = cpu . x [ o . rs1 as usize ] ; let denominator = cpu . x [ o . rs2 as usize ] ; cpu . x [ o . rd as usize ] = signed ( cpu , match denominator { 0 => numerator , _ => cpu . x [ o . rs1 as usize ] . wrapping_rem ( cpu . x [ o . rs2 as usize ] ) , } , ) ; Ok ( ( ) ) }
[rem rd,rs1,rs2]
REM and REMU provide the remainder of the corresponding division operation.
[ rem rd rs1 rs2 ] REM and REMU provide the remainder of the corresponding division operation .
cpu
&mut Cpu
_addr
u64
word
u32