use ashr from nim-stint/#76

This commit is contained in:
andri lim 2019-05-11 21:44:06 +07:00 committed by zah
parent 51e23fa582
commit 929b28b133
1 changed files with 3 additions and 8 deletions

View File

@ -906,19 +906,14 @@ op shrOp, inline = true, shift, num:
op sarOp, inline = true: op sarOp, inline = true:
let shiftLen = computation.stack.popInt().safeInt let shiftLen = computation.stack.popInt().safeInt
let x = computation.stack.popInt() let num = cast[Int256](computation.stack.popInt())
#let num = cast[Int256](computation.stack.popInt())
if shiftLen >= 256: if shiftLen >= 256:
#if num.isNegative: if num.isNegative:
if cast[Int256](x).isNegative:
push: cast[Uint256]((-1).i256) push: cast[Uint256]((-1).i256)
else: else:
push: 0 push: 0
else: else:
# ashr depends on nim-stint/#76 push: cast[Uint256](ashr(num, shiftLen))
# push: cast[Uint256](ashr(num, shiftLen))
# while waiting for stint/#76 merged, we use this workaround
push: (x shr shiftLen) or (((0-(x shr 255)) shl 1) shl (255-shiftLen))
op extCodeHash, inline = true: op extCodeHash, inline = true:
let address = computation.stack.popAddress() let address = computation.stack.popAddress()