github.com/annchain/OG@v0.0.9/common/hash_gen.go (about)

     1  package common
     2  
     3  // Code generated by github.com/tinylib/msgp DO NOT EDIT.
     4  
     5  import (
     6  	"github.com/annchain/OG/arefactor/og/types"
     7  	"github.com/tinylib/msgp/msgp"
     8  )
     9  
    10  // DecodeMsg implements msgp.Decodable
    11  func (z *Hash) DecodeMsg(dc *msgp.Reader) (err error) {
    12  	var zb0001 uint32
    13  	zb0001, err = dc.ReadArrayHeader()
    14  	if err != nil {
    15  		return
    16  	}
    17  	if zb0001 != 1 {
    18  		err = msgp.ArrayError{Wanted: 1, Got: zb0001}
    19  		return
    20  	}
    21  	err = dc.ReadExactBytes((z.Bytes)[:])
    22  	if err != nil {
    23  		return
    24  	}
    25  	return
    26  }
    27  
    28  // EncodeMsg implements msgp.Encodable
    29  func (z *Hash) EncodeMsg(en *msgp.Writer) (err error) {
    30  	// array header, size 1
    31  	err = en.Append(0x91)
    32  	if err != nil {
    33  		return
    34  	}
    35  	err = en.WriteBytes((z.Bytes)[:])
    36  	if err != nil {
    37  		return
    38  	}
    39  	return
    40  }
    41  
    42  // MarshalMsg implements msgp.Marshaler
    43  func (z *Hash) MarshalMsg(b []byte) (o []byte, err error) {
    44  	o = msgp.Require(b, z.Msgsize())
    45  	// array header, size 1
    46  	o = append(o, 0x91)
    47  	o = msgp.AppendBytes(o, (z.Bytes)[:])
    48  	return
    49  }
    50  
    51  // UnmarshalMsg implements msgp.Unmarshaler
    52  func (z *Hash) UnmarshalMsg(bts []byte) (o []byte, err error) {
    53  	var zb0001 uint32
    54  	zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts)
    55  	if err != nil {
    56  		return
    57  	}
    58  	if zb0001 != 1 {
    59  		err = msgp.ArrayError{Wanted: 1, Got: zb0001}
    60  		return
    61  	}
    62  	bts, err = msgp.ReadExactBytes(bts, (z.Bytes)[:])
    63  	if err != nil {
    64  		return
    65  	}
    66  	o = bts
    67  	return
    68  }
    69  
    70  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
    71  func (z *Hash) Msgsize() (s int) {
    72  	s = 1 + msgp.ArrayHeaderSize + (types.HashLength * (msgp.ByteSize))
    73  	return
    74  }
    75  
    76  // DecodeMsg implements msgp.Decodable
    77  func (z *HashBytes) DecodeMsg(dc *msgp.Reader) (err error) {
    78  	err = dc.ReadExactBytes((z)[:])
    79  	if err != nil {
    80  		return
    81  	}
    82  	return
    83  }
    84  
    85  // EncodeMsg implements msgp.Encodable
    86  func (z *HashBytes) EncodeMsg(en *msgp.Writer) (err error) {
    87  	err = en.WriteBytes((z)[:])
    88  	if err != nil {
    89  		return
    90  	}
    91  	return
    92  }
    93  
    94  // MarshalMsg implements msgp.Marshaler
    95  func (z *HashBytes) MarshalMsg(b []byte) (o []byte, err error) {
    96  	o = msgp.Require(b, z.Msgsize())
    97  	o = msgp.AppendBytes(o, (z)[:])
    98  	return
    99  }
   100  
   101  // UnmarshalMsg implements msgp.Unmarshaler
   102  func (z *HashBytes) UnmarshalMsg(bts []byte) (o []byte, err error) {
   103  	bts, err = msgp.ReadExactBytes(bts, (z)[:])
   104  	if err != nil {
   105  		return
   106  	}
   107  	o = bts
   108  	return
   109  }
   110  
   111  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
   112  func (z *HashBytes) Msgsize() (s int) {
   113  	s = msgp.ArrayHeaderSize + (types.HashLength * (msgp.ByteSize))
   114  	return
   115  }
   116  
   117  // DecodeMsg implements msgp.Decodable
   118  func (z *Hashes) DecodeMsg(dc *msgp.Reader) (err error) {
   119  	var zb0003 uint32
   120  	zb0003, err = dc.ReadArrayHeader()
   121  	if err != nil {
   122  		return
   123  	}
   124  	if cap((*z)) >= int(zb0003) {
   125  		(*z) = (*z)[:zb0003]
   126  	} else {
   127  		(*z) = make(Hashes, zb0003)
   128  	}
   129  	for zb0001 := range *z {
   130  		var zb0004 uint32
   131  		zb0004, err = dc.ReadArrayHeader()
   132  		if err != nil {
   133  			return
   134  		}
   135  		if zb0004 != 1 {
   136  			err = msgp.ArrayError{Wanted: 1, Got: zb0004}
   137  			return
   138  		}
   139  		err = dc.ReadExactBytes(((*z)[zb0001].Bytes)[:])
   140  		if err != nil {
   141  			return
   142  		}
   143  	}
   144  	return
   145  }
   146  
   147  // EncodeMsg implements msgp.Encodable
   148  func (z Hashes) EncodeMsg(en *msgp.Writer) (err error) {
   149  	err = en.WriteArrayHeader(uint32(len(z)))
   150  	if err != nil {
   151  		return
   152  	}
   153  	for zb0005 := range z {
   154  		// array header, size 1
   155  		err = en.Append(0x91)
   156  		if err != nil {
   157  			return
   158  		}
   159  		err = en.WriteBytes((z[zb0005].Bytes)[:])
   160  		if err != nil {
   161  			return
   162  		}
   163  	}
   164  	return
   165  }
   166  
   167  // MarshalMsg implements msgp.Marshaler
   168  func (z Hashes) MarshalMsg(b []byte) (o []byte, err error) {
   169  	o = msgp.Require(b, z.Msgsize())
   170  	o = msgp.AppendArrayHeader(o, uint32(len(z)))
   171  	for zb0005 := range z {
   172  		// array header, size 1
   173  		o = append(o, 0x91)
   174  		o = msgp.AppendBytes(o, (z[zb0005].Bytes)[:])
   175  	}
   176  	return
   177  }
   178  
   179  // UnmarshalMsg implements msgp.Unmarshaler
   180  func (z *Hashes) UnmarshalMsg(bts []byte) (o []byte, err error) {
   181  	var zb0003 uint32
   182  	zb0003, bts, err = msgp.ReadArrayHeaderBytes(bts)
   183  	if err != nil {
   184  		return
   185  	}
   186  	if cap((*z)) >= int(zb0003) {
   187  		(*z) = (*z)[:zb0003]
   188  	} else {
   189  		(*z) = make(Hashes, zb0003)
   190  	}
   191  	for zb0001 := range *z {
   192  		var zb0004 uint32
   193  		zb0004, bts, err = msgp.ReadArrayHeaderBytes(bts)
   194  		if err != nil {
   195  			return
   196  		}
   197  		if zb0004 != 1 {
   198  			err = msgp.ArrayError{Wanted: 1, Got: zb0004}
   199  			return
   200  		}
   201  		bts, err = msgp.ReadExactBytes(bts, ((*z)[zb0001].Bytes)[:])
   202  		if err != nil {
   203  			return
   204  		}
   205  	}
   206  	o = bts
   207  	return
   208  }
   209  
   210  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
   211  func (z Hashes) Msgsize() (s int) {
   212  	s = msgp.ArrayHeaderSize + (len(z) * (7 + (HashLength * (msgp.ByteSize))))
   213  	return
   214  }
   215  
   216  // DecodeMsg implements msgp.Decodable
   217  func (z *Padding) DecodeMsg(dc *msgp.Reader) (err error) {
   218  	{
   219  		var zb0001 uint
   220  		zb0001, err = dc.ReadUint()
   221  		if err != nil {
   222  			return
   223  		}
   224  		(*z) = Padding(zb0001)
   225  	}
   226  	return
   227  }
   228  
   229  // EncodeMsg implements msgp.Encodable
   230  func (z Padding) EncodeMsg(en *msgp.Writer) (err error) {
   231  	err = en.WriteUint(uint(z))
   232  	if err != nil {
   233  		return
   234  	}
   235  	return
   236  }
   237  
   238  // MarshalMsg implements msgp.Marshaler
   239  func (z Padding) MarshalMsg(b []byte) (o []byte, err error) {
   240  	o = msgp.Require(b, z.Msgsize())
   241  	o = msgp.AppendUint(o, uint(z))
   242  	return
   243  }
   244  
   245  // UnmarshalMsg implements msgp.Unmarshaler
   246  func (z *Padding) UnmarshalMsg(bts []byte) (o []byte, err error) {
   247  	{
   248  		var zb0001 uint
   249  		zb0001, bts, err = msgp.ReadUintBytes(bts)
   250  		if err != nil {
   251  			return
   252  		}
   253  		(*z) = Padding(zb0001)
   254  	}
   255  	o = bts
   256  	return
   257  }
   258  
   259  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
   260  func (z Padding) Msgsize() (s int) {
   261  	s = msgp.UintSize
   262  	return
   263  }