MCPcopy
hub / github.com/tinylib/msgp / AppendUint64

Function AppendUint64

msgp/write_bytes.go:149–175  ·  view source on GitHub ↗

AppendUint64 appends a uint64 to the slice

(b []byte, u uint64)

Source from the content-addressed store, hash-verified

147
148// AppendUint64 appends a uint64 to the slice
149func AppendUint64(b []byte, u uint64) []byte {
150 switch {
151 case u <= (1<<7)-1:
152 return append(b, wfixint(uint8(u)))
153
154 case u <= math.MaxUint8:
155 o, n := ensure(b, 2)
156 putMuint8(o[n:], uint8(u))
157 return o
158
159 case u <= math.MaxUint16:
160 o, n := ensure(b, 3)
161 putMuint16(o[n:], uint16(u))
162 return o
163
164 case u <= math.MaxUint32:
165 o, n := ensure(b, 5)
166 putMuint32(o[n:], uint32(u))
167 return o
168
169 default:
170 o, n := ensure(b, 9)
171 putMuint64(o[n:], u)
172 return o
173
174 }
175}
176
177// AppendUint appends a uint to the slice
178func AppendUint(b []byte, u uint) []byte { return AppendUint64(b, uint64(u)) }

Callers 13

MarshalMsgMethod · 0.92
MarshalMsgMethod · 0.92
MarshalMsgMethod · 0.85
BenchmarkReadUint64Function · 0.85
AppendUintFunction · 0.85
AppendUint8Function · 0.85
AppendUint16Function · 0.85
AppendUint32Function · 0.85
AppendIntfFunction · 0.85
TestAppendUint64Function · 0.85

Calls 6

wfixintFunction · 0.85
putMuint8Function · 0.85
putMuint16Function · 0.85
putMuint32Function · 0.85
putMuint64Function · 0.85
ensureFunction · 0.70

Tested by 5

BenchmarkReadUint64Function · 0.68
TestAppendUint64Function · 0.68
BenchmarkAppendUint64Function · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…