diff options
author | obscuren <geffobscura@gmail.com> | 2014-08-22 01:23:54 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-08-22 01:23:54 +0800 |
commit | 854d6d4e5cb8783e18397fef655ad79065263cc2 (patch) | |
tree | 9482a5ca5b2bea3c0f391ce116d381e1ba19eab9 /ethvm/vm.go | |
parent | a289a77d5de2a2cfa6b38f294b4ab953ebc1bfb8 (diff) | |
download | go-tangerine-854d6d4e5cb8783e18397fef655ad79065263cc2.tar go-tangerine-854d6d4e5cb8783e18397fef655ad79065263cc2.tar.gz go-tangerine-854d6d4e5cb8783e18397fef655ad79065263cc2.tar.bz2 go-tangerine-854d6d4e5cb8783e18397fef655ad79065263cc2.tar.lz go-tangerine-854d6d4e5cb8783e18397fef655ad79065263cc2.tar.xz go-tangerine-854d6d4e5cb8783e18397fef655ad79065263cc2.tar.zst go-tangerine-854d6d4e5cb8783e18397fef655ad79065263cc2.zip |
DUP/SWAP n & ADD/MULMOD
Diffstat (limited to 'ethvm/vm.go')
-rw-r--r-- | ethvm/vm.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/ethvm/vm.go b/ethvm/vm.go index b27417586..29dc2515c 100644 --- a/ethvm/vm.go +++ b/ethvm/vm.go @@ -439,6 +439,36 @@ func (self *Vm) RunClosure(closure *Closure) (ret []byte, err error) { } else { stack.Push(ethutil.BigFalse) } + case ADDMOD: + require(3) + + x := stack.Pop() + y := stack.Pop() + z := stack.Pop() + + base.Add(x, y) + base.Mod(base, z) + + ensure256(base) + + self.Printf(" = %v", base) + + stack.Push(base) + case MULMOD: + require(3) + + x := stack.Pop() + y := stack.Pop() + z := stack.Pop() + + base.Mul(x, y) + base.Mod(base, z) + + ensure256(base) + + self.Printf(" = %v", base) + + stack.Push(base) // 0x20 range case SHA3: |