We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c158636 commit 4f4b88eCopy full SHA for 4f4b88e
lib/opFns.js
@@ -179,16 +179,18 @@ module.exports = {
179
if (!runState._common.gteHardfork('constantinople')) {
180
trap(ERROR.INVALID_OPCODE)
181
}
182
+ const isSigned = b.testn(255)
183
if (a.gten(256)) {
184
if (b.fromTwos(256).ltn(0)) {
- return new BN(-1).toTwos(256)
185
+ return new BN(utils.MAX_INTEGER)
186
} else {
187
return new BN(0)
188
189
190
const c = b.shrn(a.toNumber())
191
if (b.testn(255)) {
- const mask = utils.MAX_INTEGER.shrn(255 - a.toNumber())
192
+ const shiftedOutWidth = 255 - a.toNumber()
193
+ const mask = utils.MAX_INTEGER.shrn(shiftOutWidth).shln(shiftedOutWidth)
194
return c.ior(mask)
195
196
return c
0 commit comments