Merge conflicts
This commit is contained in:
@ -36,6 +36,7 @@ func CurrencyToString(num *big.Int) string {
|
||||
|
||||
var (
|
||||
Big1 = big.NewInt(1)
|
||||
Big2 = big.NewInt(1)
|
||||
Big0 = big.NewInt(0)
|
||||
Big256 = big.NewInt(0xff)
|
||||
)
|
||||
|
@ -131,7 +131,7 @@ func Instr(instr string) (int, []string, error) {
|
||||
|
||||
// Script compilation functions
|
||||
// Compiles strings to machine code
|
||||
func Compile(instructions ...interface{}) (script []string) {
|
||||
func Assemble(instructions ...interface{}) (script []string) {
|
||||
script = make([]string, len(instructions))
|
||||
|
||||
for i, val := range instructions {
|
||||
|
@ -57,7 +57,7 @@ func DecodeWithReader(reader *bytes.Buffer) interface{} {
|
||||
switch {
|
||||
case char == 0:
|
||||
return nil
|
||||
case char <= 0x7c:
|
||||
case char <= 0x7f:
|
||||
return char
|
||||
|
||||
case char <= 0xb7:
|
||||
|
@ -129,6 +129,11 @@ func TestEncodeDecodeBytes(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestEncodeZero(t *testing.T) {
|
||||
b := NewValue(0).Encode()
|
||||
fmt.Println(b)
|
||||
}
|
||||
|
||||
func BenchmarkEncodeDecode(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
bytes := Encode([]interface{}{"dog", "god", "cat"})
|
||||
|
@ -149,6 +149,15 @@ func (val *Value) IsStr() bool {
|
||||
return val.Type() == reflect.String
|
||||
}
|
||||
|
||||
// Special list checking function. Something is considered
|
||||
// a list if it's of type []interface{}. The list is usually
|
||||
// used in conjunction with rlp decoded streams.
|
||||
func (val *Value) IsList() bool {
|
||||
_, ok := val.Val.([]interface{})
|
||||
|
||||
return ok
|
||||
}
|
||||
|
||||
func (val *Value) IsEmpty() bool {
|
||||
return val.Val == nil || ((val.IsSlice() || val.IsStr()) && val.Len() == 0)
|
||||
}
|
||||
|
Reference in New Issue
Block a user