aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/common.go
diff options
context:
space:
mode:
authorjm <jm.huang@cobinhood.com>2019-01-15 00:48:13 +0800
committerJhih-Ming Huang <jm.huang@cobinhood.com>2019-05-06 10:44:03 +0800
commit266068a53cdf9e06acacf982d63653c03133a634 (patch)
treeaf2d74e6adb309adfe39bafaa2f540fe0bcd1a31 /core/vm/common.go
parentd41cb421d755b8f0bca87b7476f26aa4b879b9d9 (diff)
downloaddexon-266068a53cdf9e06acacf982d63653c03133a634.tar
dexon-266068a53cdf9e06acacf982d63653c03133a634.tar.gz
dexon-266068a53cdf9e06acacf982d63653c03133a634.tar.bz2
dexon-266068a53cdf9e06acacf982d63653c03133a634.tar.lz
dexon-266068a53cdf9e06acacf982d63653c03133a634.tar.xz
dexon-266068a53cdf9e06acacf982d63653c03133a634.tar.zst
dexon-266068a53cdf9e06acacf982d63653c03133a634.zip
core: vm: refactor file structure
For support other vm types, this pr modified the core/vm file structures.
Diffstat (limited to 'core/vm/common.go')
-rw-r--r--core/vm/common.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/core/vm/common.go b/core/vm/common.go
index 7702b2a86..6b8c4667b 100644
--- a/core/vm/common.go
+++ b/core/vm/common.go
@@ -24,7 +24,7 @@ import (
)
// calculates the memory size required for a step
-func calcMemSize(off, l *big.Int) *big.Int {
+func CalcMemSize(off, l *big.Int) *big.Int {
if l.Sign() == 0 {
return common.Big0
}
@@ -34,7 +34,7 @@ func calcMemSize(off, l *big.Int) *big.Int {
// getData returns a slice from the data based on the start and size and pads
// up to size with zero's. This function is overflow safe.
-func getData(data []byte, start uint64, size uint64) []byte {
+func GetData(data []byte, start uint64, size uint64) []byte {
length := uint64(len(data))
if start > length {
start = length
@@ -48,7 +48,7 @@ func getData(data []byte, start uint64, size uint64) []byte {
// getDataBig returns a slice from the data based on the start and size and pads
// up to size with zero's. This function is overflow safe.
-func getDataBig(data []byte, start *big.Int, size *big.Int) []byte {
+func GetDataBig(data []byte, start *big.Int, size *big.Int) []byte {
dlen := big.NewInt(int64(len(data)))
s := math.BigMin(start, dlen)
@@ -58,12 +58,12 @@ func getDataBig(data []byte, start *big.Int, size *big.Int) []byte {
// bigUint64 returns the integer casted to a uint64 and returns whether it
// overflowed in the process.
-func bigUint64(v *big.Int) (uint64, bool) {
+func BigUint64(v *big.Int) (uint64, bool) {
return v.Uint64(), v.BitLen() > 64
}
// toWordSize returns the ceiled word size required for memory expansion.
-func toWordSize(size uint64) uint64 {
+func ToWordSize(size uint64) uint64 {
if size > math.MaxUint64-31 {
return math.MaxUint64/32 + 1
}
@@ -71,7 +71,7 @@ func toWordSize(size uint64) uint64 {
return (size + 31) / 32
}
-func allZero(b []byte) bool {
+func AllZero(b []byte) bool {
for _, byte := range b {
if byte != 0 {
return false