git.delta.rocks / unique-network / refs/commits / e642a25dd4d7

difftreelog

fix(calibrate) operand stack order

Yaroslav Bolyukin2022-12-19parent: #272aaf6.patch.diff
in: master

1 file changed

modifiedtests/src/calibrate.tsdiffbeforeafterboth
72 } else if (op === '+') {72 } else if (op === '+') {
73 if (stack.length < 2)73 if (stack.length < 2)
74 throw new Error('stack underflow');74 throw new Error('stack underflow');
75 const a = stack.pop()!;
76 const b = stack.pop()!;75 const b = stack.pop()!;
76 const a = stack.pop()!;
77 stack.push(a.plus(b));77 stack.push(a.plus(b));
78 } else if (op === '*') {78 } else if (op === '*') {
79 if (stack.length < 2)79 if (stack.length < 2)
80 throw new Error('stack underflow');80 throw new Error('stack underflow');
81 const a = stack.pop()!;81 const b = stack.pop()!;
82 const b = stack.pop()!;82 const a = stack.pop()!;
83 stack.push(a.mul(b));83 stack.push(a.mul(b));
84 } else if (op === '-') {84 } else if (op === '-') {
85 if (stack.length < 2)85 if (stack.length < 2)
86 throw new Error('stack underflow');86 throw new Error('stack underflow');
87 const a = stack.pop()!;87 const b = stack.pop()!;
88 const b = stack.pop()!;88 const a = stack.pop()!;
89 stack.push(a.minus(b));89 stack.push(a.minus(b));
90 } else if (op === '/') {90 } else if (op === '/') {
91 if (stack.length < 2)91 if (stack.length < 2)
92 throw new Error('stack underflow');92 throw new Error('stack underflow');
93 const a = stack.pop()!;93 const b = stack.pop()!;
94 const b = stack.pop()!;94 const a = stack.pop()!;
95 stack.push(a.div(b));95 stack.push(a.div(b));
96 } else if (op === 'dup') {96 } else if (op === 'dup') {
97 if (stack.length < 1)97 if (stack.length < 1)