-
Notifications
You must be signed in to change notification settings - Fork 471
/
msgp_gen.go
165 lines (154 loc) · 4.15 KB
/
msgp_gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
package generickv
// Code generated by github.com/algorand/msgp DO NOT EDIT.
import (
"github.com/algorand/msgp/msgp"
"github.com/algorand/go-algorand/data/basics"
)
// The following msgp objects are implemented in this file:
// creatableEntry
// |-----> (*) MarshalMsg
// |-----> (*) CanMarshalMsg
// |-----> (*) UnmarshalMsg
// |-----> (*) UnmarshalMsgWithState
// |-----> (*) CanUnmarshalMsg
// |-----> (*) Msgsize
// |-----> (*) MsgIsZero
// |-----> CreatableEntryMaxSize()
//
// MarshalMsg implements msgp.Marshaler
func (z *creatableEntry) MarshalMsg(b []byte) (o []byte) {
o = msgp.Require(b, z.Msgsize())
// omitempty: check for empty values
zb0001Len := uint32(2)
var zb0001Mask uint8 /* 3 bits */
if len((*z).CreatorAddr) == 0 {
zb0001Len--
zb0001Mask |= 0x1
}
if (*z).Ctype.MsgIsZero() {
zb0001Len--
zb0001Mask |= 0x2
}
// variable map header, size zb0001Len
o = append(o, 0x80|uint8(zb0001Len))
if zb0001Len != 0 {
if (zb0001Mask & 0x1) == 0 { // if not empty
// string "CreatorAddr"
o = append(o, 0xab, 0x43, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72)
o = msgp.AppendBytes(o, (*z).CreatorAddr)
}
if (zb0001Mask & 0x2) == 0 { // if not empty
// string "Ctype"
o = append(o, 0xa5, 0x43, 0x74, 0x79, 0x70, 0x65)
o = (*z).Ctype.MarshalMsg(o)
}
}
return
}
func (_ *creatableEntry) CanMarshalMsg(z interface{}) bool {
_, ok := (z).(*creatableEntry)
return ok
}
// UnmarshalMsg implements msgp.Unmarshaler
func (z *creatableEntry) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error) {
if st.AllowableDepth == 0 {
err = msgp.ErrMaxDepthExceeded{}
return
}
st.AllowableDepth--
var field []byte
_ = field
var zb0001 int
var zb0002 bool
zb0001, zb0002, bts, err = msgp.ReadMapHeaderBytes(bts)
if _, ok := err.(msgp.TypeError); ok {
zb0001, zb0002, bts, err = msgp.ReadArrayHeaderBytes(bts)
if err != nil {
err = msgp.WrapError(err)
return
}
if zb0001 > 0 {
zb0001--
bts, err = (*z).Ctype.UnmarshalMsgWithState(bts, st)
if err != nil {
err = msgp.WrapError(err, "struct-from-array", "Ctype")
return
}
}
if zb0001 > 0 {
zb0001--
(*z).CreatorAddr, bts, err = msgp.ReadBytesBytes(bts, (*z).CreatorAddr)
if err != nil {
err = msgp.WrapError(err, "struct-from-array", "CreatorAddr")
return
}
}
if zb0001 > 0 {
err = msgp.ErrTooManyArrayFields(zb0001)
if err != nil {
err = msgp.WrapError(err, "struct-from-array")
return
}
}
} else {
if err != nil {
err = msgp.WrapError(err)
return
}
if zb0002 {
(*z) = creatableEntry{}
}
for zb0001 > 0 {
zb0001--
field, bts, err = msgp.ReadMapKeyZC(bts)
if err != nil {
err = msgp.WrapError(err)
return
}
switch string(field) {
case "Ctype":
bts, err = (*z).Ctype.UnmarshalMsgWithState(bts, st)
if err != nil {
err = msgp.WrapError(err, "Ctype")
return
}
case "CreatorAddr":
(*z).CreatorAddr, bts, err = msgp.ReadBytesBytes(bts, (*z).CreatorAddr)
if err != nil {
err = msgp.WrapError(err, "CreatorAddr")
return
}
default:
err = msgp.ErrNoField(string(field))
if err != nil {
err = msgp.WrapError(err)
return
}
}
}
}
o = bts
return
}
func (z *creatableEntry) UnmarshalMsg(bts []byte) (o []byte, err error) {
return z.UnmarshalMsgWithState(bts, msgp.DefaultUnmarshalState)
}
func (_ *creatableEntry) CanUnmarshalMsg(z interface{}) bool {
_, ok := (z).(*creatableEntry)
return ok
}
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z *creatableEntry) Msgsize() (s int) {
s = 1 + 6 + (*z).Ctype.Msgsize() + 12 + msgp.BytesPrefixSize + len((*z).CreatorAddr)
return
}
// MsgIsZero returns whether this is a zero value
func (z *creatableEntry) MsgIsZero() bool {
return ((*z).Ctype.MsgIsZero()) && (len((*z).CreatorAddr) == 0)
}
// MaxSize returns a maximum valid message size for this message type
func CreatableEntryMaxSize() (s int) {
s = 1 + 6 + basics.CreatableTypeMaxSize() + 12
panic("Unable to determine max size: Byteslice type z.CreatorAddr is unbounded")
return
}