Skip to content

Commit

Permalink
Implement SAR
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Jul 23, 2018
1 parent 76da77d commit 4bbdf55
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/opFns.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,19 @@ module.exports = {
if (!runState._common.gteHardfork('constantinople')) {
trap(ERROR.INVALID_OPCODE)
}
b = b.fromTwos(256)
if (a.gten(256)) {
if (b.ltn(0)) {
if (b.fromTwos(256).ltn(0)) {
return new BN(-1).toTwos(256)
} else {
return new BN(0)
}
}
// FIXME: implement
var c = b.shrn(a.toNumber())
if (b.testn(255)) {
return c.iand(utils.MAX_INTEGER)
} else {
return c
}
},
// 0x20 range - crypto
SHA3: function (offset, length, runState) {
Expand Down

0 comments on commit 4bbdf55

Please sign in to comment.