Erk- / RRust

RRust, a reversible Rust DSL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for rotate

Erk- opened this issue · comments

commented

When rotate_left is used the inverse should be rotate_right and the same the other way around.

For example

a.rotate_left(b);
// ↓ 
a.rotate_right(b);

This is likely not enough since rotate is not a mutating operation so a way would be to make our own function along the lines of:

fn rotate_left(i: &mut u32, n: u32) {
    *i = *i.rotate_left(n);
}

And then swap that between left and right in the reverse macro.