From 266068a53cdf9e06acacf982d63653c03133a634 Mon Sep 17 00:00:00 2001 From: jm Date: Tue, 15 Jan 2019 00:48:13 +0800 Subject: core: vm: refactor file structure For support other vm types, this pr modified the core/vm file structures. --- core/vm/common.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'core/vm/common.go') 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 -- cgit v1.2.3