~torresjrjr/dc

604739e9e70cdbc9876556ad3e2617a23b687fe5 — Byron Torres 6 months ago 5800671
fix operand order
1 files changed, 7 insertions(+), 7 deletions(-)

M dc.ha
M dc.ha => dc.ha +7 -7
@@ 89,10 89,10 @@ export fn main() void = {
		case 'd' =>
			push(peek());
		case 'r' =>
			const a = pop();
			const b = pop();
			push(a);
			const a = pop();
			push(b);
			push(a);
		case 'R' =>
			let n = pop(): int;
			if (n > 1) {


@@ 115,40 115,40 @@ export fn main() void = {
				fmt::errorln("dc: stack has too few elements")?;
				continue;
			};
			const a = pop();
			const b = pop();
			const a = pop();
			push(a + b);
		case '-' =>
			if (len(S) < 2) {
				fmt::errorln("dc: stack has too few elements")?;
				continue;
			};
			const a = pop();
			const b = pop();
			const a = pop();
			push(a - b);
		case '*' =>
			if (len(S) < 2) {
				fmt::errorln("dc: stack has too few elements")?;
				continue;
			};
			const a = pop();
			const b = pop();
			const a = pop();
			push(a * b);
		case '/' =>
			if (len(S) < 2) {
				fmt::errorln("dc: stack has too few elements")?;
				continue;
			};
			const a = pop();
			const b = pop();
			const a = pop();
			push(a / b);
		case '%' =>
			if (len(S) < 2) {
				fmt::errorln("dc: stack has too few elements")?;
				continue;
			};
			const a = pop();
			const b = pop();
			const a = pop();
			push(math::modf64(a, b));
		case =>
			fmt::errorfln("dc: unimplemented '{}'", r)?;