Skip to content

Commit a7dc6a0

Browse files
committed
add swap_ops utility macro
1 parent 2a619bf commit a7dc6a0

File tree

1 file changed

+11
-0
lines changed
  • crates/wasmi/src/engine/translator/func2

1 file changed

+11
-0
lines changed

crates/wasmi/src/engine/translator/func2/utils.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ macro_rules! bail_unreachable {
1717
}};
1818
}
1919

20+
/// Used to swap operands of binary [`Instruction`] constructor.
21+
///
22+
/// [`Instruction`]: crate::ir::Instruction
23+
macro_rules! swap_ops {
24+
($make_instr:path) => {
25+
|result: $crate::ir::Reg, lhs, rhs| -> $crate::ir::Instruction {
26+
$make_instr(result, rhs, lhs)
27+
}
28+
};
29+
}
30+
2031
/// Implemented by types that can be reset for reuse.
2132
pub trait Reset: Sized {
2233
/// Resets `self` for reuse.

0 commit comments

Comments
 (0)