github.com/theQRL/go-zond@v0.1.1/rlp/rlpgen/testdata/bigint.out.txt (about)

     1  package test
     2  
     3  import "github.com/theQRL/go-zond/rlp"
     4  import "io"
     5  
     6  func (obj *Test) EncodeRLP(_w io.Writer) error {
     7  	w := rlp.NewEncoderBuffer(_w)
     8  	_tmp0 := w.List()
     9  	if obj.Int == nil {
    10  		w.Write(rlp.EmptyString)
    11  	} else {
    12  		if obj.Int.Sign() == -1 {
    13  			return rlp.ErrNegativeBigInt
    14  		}
    15  		w.WriteBigInt(obj.Int)
    16  	}
    17  	if obj.IntNoPtr.Sign() == -1 {
    18  		return rlp.ErrNegativeBigInt
    19  	}
    20  	w.WriteBigInt(&obj.IntNoPtr)
    21  	w.ListEnd(_tmp0)
    22  	return w.Flush()
    23  }
    24  
    25  func (obj *Test) DecodeRLP(dec *rlp.Stream) error {
    26  	var _tmp0 Test
    27  	{
    28  		if _, err := dec.List(); err != nil {
    29  			return err
    30  		}
    31  		// Int:
    32  		_tmp1, err := dec.BigInt()
    33  		if err != nil {
    34  			return err
    35  		}
    36  		_tmp0.Int = _tmp1
    37  		// IntNoPtr:
    38  		_tmp2, err := dec.BigInt()
    39  		if err != nil {
    40  			return err
    41  		}
    42  		_tmp0.IntNoPtr = (*_tmp2)
    43  		if err := dec.ListEnd(); err != nil {
    44  			return err
    45  		}
    46  	}
    47  	*obj = _tmp0
    48  	return nil
    49  }