Skip to content

Commit

Permalink
Explicit integer convert for Boolean returning opcodes
Browse files Browse the repository at this point in the history
  • Loading branch information
holgerd77 authored and axic committed Jan 30, 2018
1 parent 8400c21 commit 3e9b1da
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/opFns.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,22 +122,22 @@ module.exports = {
},
// 0x10 range - bit ops
LT: function (a, b, runState) {
return new BN(a.cmp(b) === -1)
return new BN(a.cmp(b) === -1 ? 1 : 0)
},
GT: function (a, b, runState) {
return new BN(a.cmp(b) === 1)
return new BN(a.cmp(b) === 1 ? 1 : 0)
},
SLT: function (a, b, runState) {
return new BN(a.fromTwos(256).cmp(b.fromTwos(256)) === -1)
return new BN(a.fromTwos(256).cmp(b.fromTwos(256)) === -1 ? 1 : 0)
},
SGT: function (a, b, runState) {
return new BN(a.fromTwos(256).cmp(b.fromTwos(256)) === 1)
return new BN(a.fromTwos(256).cmp(b.fromTwos(256)) === 1 ? 1 : 0)
},
EQ: function (a, b, runState) {
return new BN(a.cmp(b) === 0)
return new BN(a.cmp(b) === 0 ? 1 : 0)
},
ISZERO: function (a, runState) {
return new BN(a.isZero())
return new BN(a.isZero() ? 1 : 0)
},
AND: function (a, b, runState) {
return a.and(b)
Expand Down

0 comments on commit 3e9b1da

Please sign in to comment.