rlp: add Split functions

These functions allow destructuring of raw rlp-encoded bytes
without the overhead of reflection or copying.
This commit is contained in:
Felix Lange
2015-07-01 02:09:02 +02:00
parent ac32f52ca6
commit bc17dba8fb
3 changed files with 337 additions and 1 deletions

View File

@@ -24,6 +24,7 @@ import (
"io"
"math/big"
"reflect"
"strings"
"testing"
)
@@ -725,7 +726,7 @@ func encodeTestSlice(n uint) []byte {
}
func unhex(str string) []byte {
b, err := hex.DecodeString(str)
b, err := hex.DecodeString(strings.Replace(str, " ", "", -1))
if err != nil {
panic(fmt.Sprintf("invalid hex string: %q", str))
}