aboutsummaryrefslogtreecommitdiffstats
path: root/vm/vm_debug.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-11-01 09:14:55 +0800
committerobscuren <geffobscura@gmail.com>2014-11-01 09:14:55 +0800
commit3f90f7c89856f5d024eec1df535a4fc2871214c2 (patch)
tree8513bddf2539b6dfadca894092449abdbcd623a8 /vm/vm_debug.go
parentc8438979a9c5c73bf68a132d5fd0325863ab454b (diff)
downloadgo-tangerine-3f90f7c89856f5d024eec1df535a4fc2871214c2.tar
go-tangerine-3f90f7c89856f5d024eec1df535a4fc2871214c2.tar.gz
go-tangerine-3f90f7c89856f5d024eec1df535a4fc2871214c2.tar.bz2
go-tangerine-3f90f7c89856f5d024eec1df535a4fc2871214c2.tar.lz
go-tangerine-3f90f7c89856f5d024eec1df535a4fc2871214c2.tar.xz
go-tangerine-3f90f7c89856f5d024eec1df535a4fc2871214c2.tar.zst
go-tangerine-3f90f7c89856f5d024eec1df535a4fc2871214c2.zip
Signextend
Diffstat (limited to 'vm/vm_debug.go')
-rw-r--r--vm/vm_debug.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/vm/vm_debug.go b/vm/vm_debug.go
index 0abfa098d..129ea1a59 100644
--- a/vm/vm_debug.go
+++ b/vm/vm_debug.go
@@ -392,6 +392,20 @@ func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) {
self.Printf(" = %v", base)
stack.Push(base)
+ case SIGNEXTEND:
+ back := stack.Pop().Uint64()
+ if back.Cmp(big.NewInt(31)) < 0 {
+ bit := uint(back*8 + 7)
+ num := stack.Pop()
+ mask := new(big.Int).Lsh(ethutil.Big1, bit)
+ mask.Sub(mask, ethutil.Big1)
+ if ethutil.BitTest(num, int(bit)) {
+ num.Or(num, mask.Not(mask))
+ } else {
+ num.And(num, mask)
+ }
+ stack.Push(num)
+ }
case NOT:
base.Sub(Pow256, stack.Pop()).Sub(base, ethutil.Big1)