Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
2565a795
Commit
2565a795
authored
Jun 17, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Swapped vars
parent
8a885c26
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
17 deletions
+9
-17
vm.go
ethchain/vm.go
+9
-17
No files found.
ethchain/vm.go
View file @
2565a795
...
...
@@ -226,28 +226,28 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
require
(
2
)
x
,
y
:=
stack
.
Popn
()
// (x + y) % 2 ** 256
base
.
Add
(
x
,
y
)
base
.
Add
(
y
,
x
)
// Pop result back on the stack
stack
.
Push
(
base
)
case
SUB
:
require
(
2
)
x
,
y
:=
stack
.
Popn
()
// (x - y) % 2 ** 256
base
.
Sub
(
x
,
y
)
base
.
Sub
(
y
,
x
)
// Pop result back on the stack
stack
.
Push
(
base
)
case
MUL
:
require
(
2
)
x
,
y
:=
stack
.
Popn
()
// (x * y) % 2 ** 256
base
.
Mul
(
x
,
y
)
base
.
Mul
(
y
,
x
)
// Pop result back on the stack
stack
.
Push
(
base
)
case
DIV
:
require
(
2
)
x
,
y
:=
stack
.
Popn
()
// floor(x / y)
base
.
Div
(
x
,
y
)
base
.
Div
(
y
,
x
)
// Pop result back on the stack
stack
.
Push
(
base
)
case
SDIV
:
...
...
@@ -270,7 +270,7 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
case
MOD
:
require
(
2
)
x
,
y
:=
stack
.
Popn
()
base
.
Mod
(
x
,
y
)
base
.
Mod
(
y
,
x
)
stack
.
Push
(
base
)
case
SMOD
:
require
(
2
)
...
...
@@ -292,7 +292,7 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
case
EXP
:
require
(
2
)
x
,
y
:=
stack
.
Popn
()
base
.
Exp
(
x
,
y
,
Pow256
)
base
.
Exp
(
y
,
x
,
Pow256
)
stack
.
Push
(
base
)
case
NEG
:
...
...
@@ -302,6 +302,7 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
case
LT
:
require
(
2
)
y
,
x
:=
stack
.
Popn
()
vm
.
Printf
(
" %v < %v"
,
x
,
y
)
// x < y
if
x
.
Cmp
(
y
)
<
0
{
stack
.
Push
(
ethutil
.
BigTrue
)
...
...
@@ -342,20 +343,11 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
case
AND
:
require
(
2
)
x
,
y
:=
stack
.
Popn
()
if
(
x
.
Cmp
(
ethutil
.
BigTrue
)
>=
0
)
&&
(
y
.
Cmp
(
ethutil
.
BigTrue
)
>=
0
)
{
stack
.
Push
(
ethutil
.
BigTrue
)
}
else
{
stack
.
Push
(
ethutil
.
BigFalse
)
}
stack
.
Push
(
base
.
And
(
y
,
x
))
case
OR
:
require
(
2
)
x
,
y
:=
stack
.
Popn
()
if
(
x
.
Cmp
(
ethutil
.
BigInt0
)
>=
0
)
||
(
y
.
Cmp
(
ethutil
.
BigInt0
)
>=
0
)
{
stack
.
Push
(
ethutil
.
BigTrue
)
}
else
{
stack
.
Push
(
ethutil
.
BigFalse
)
}
stack
.
Push
(
base
.
Or
(
y
,
x
))
case
XOR
:
require
(
2
)
x
,
y
:=
stack
.
Popn
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment