-
Notifications
You must be signed in to change notification settings - Fork 20.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
115 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// -*- mode: go -*- | ||
|
||
package test | ||
|
||
import "github.com/holiman/uint256" | ||
|
||
type Test struct { | ||
Int *uint256.Int | ||
IntNoPtr uint256.Int | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package test | ||
|
||
import "github.com/ethereum/go-ethereum/rlp" | ||
import "github.com/holiman/uint256" | ||
import "io" | ||
|
||
func (obj *Test) EncodeRLP(_w io.Writer) error { | ||
w := rlp.NewEncoderBuffer(_w) | ||
_tmp0 := w.List() | ||
if obj.Int == nil { | ||
w.Write(rlp.EmptyString) | ||
} else { | ||
w.WriteUint256(obj.Int) | ||
} | ||
w.WriteUint256(&obj.IntNoPtr) | ||
w.ListEnd(_tmp0) | ||
return w.Flush() | ||
} | ||
|
||
func (obj *Test) DecodeRLP(dec *rlp.Stream) error { | ||
var _tmp0 Test | ||
{ | ||
if _, err := dec.List(); err != nil { | ||
return err | ||
} | ||
// Int: | ||
var _tmp1 uint256.Int | ||
if err := dec.DecodeUint256(&_tmp1); err != nil { | ||
return err | ||
} | ||
_tmp0.Int = &_tmp1 | ||
// IntNoPtr: | ||
var _tmp2 uint256.Int | ||
if err := dec.DecodeUint256(&_tmp2); err != nil { | ||
return err | ||
} | ||
_tmp0.IntNoPtr = _tmp2 | ||
if err := dec.ListEnd(); err != nil { | ||
return err | ||
} | ||
} | ||
*obj = _tmp0 | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters