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
3f90f7c8
Commit
3f90f7c8
authored
Nov 01, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Signextend
parent
c8438979
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
big.go
ethutil/big.go
+4
-0
vm_debug.go
vm/vm_debug.go
+14
-0
No files found.
ethutil/big.go
View file @
3f90f7c8
...
...
@@ -34,6 +34,10 @@ func BigD(data []byte) *big.Int {
return
n
}
func
BitTest
(
num
*
big
.
Int
,
i
int
)
bool
{
return
num
.
Bit
(
i
)
>
0
}
// To256
//
// "cast" the big int to a 256 big int (i.e., limit to)
...
...
vm/vm_debug.go
View file @
3f90f7c8
...
...
@@ -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
)
...
...
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