mirror of
https://github.com/uutils/awk.git
synced 2026-06-10 16:15:04 -07:00
interpreter: small cleanup
This commit is contained in:
@@ -320,7 +320,6 @@ impl Display for Instruction {
|
||||
| OpCode::Negation
|
||||
| OpCode::ToInt
|
||||
| OpCode::Negative
|
||||
| OpCode::Concat
|
||||
| OpCode::Copy) => {
|
||||
let (dest, data) = unsafe { &self.args.unary_local };
|
||||
write!(f, "{dest} <- {op} {data}")
|
||||
@@ -340,6 +339,7 @@ impl Display for Instruction {
|
||||
| OpCode::Multiply
|
||||
| OpCode::Divide
|
||||
| OpCode::Raise
|
||||
| OpCode::Concat
|
||||
| OpCode::Modulo) => {
|
||||
let (dest, lhs, rhs) = unsafe { &self.args.binary_local };
|
||||
write!(f, "{dest} <- {op} {lhs}, {rhs}")
|
||||
|
||||
@@ -117,7 +117,7 @@ impl Interpreter<'_> {
|
||||
let src = self.registers.get(src);
|
||||
let val = match ix.opcode {
|
||||
OpCode::Record => todo!(),
|
||||
OpCode::Negation => Value::Float(!src.to_bool() as usize as f64),
|
||||
OpCode::Negation => Value::b2f(!src.to_bool()),
|
||||
OpCode::ToInt => Value::Float(src.to_num()),
|
||||
OpCode::Negative => Value::Float(-src.to_num()),
|
||||
_ => unreachable!(),
|
||||
|
||||
Reference in New Issue
Block a user