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

Function AppendArrayHeader

msgp/write_bytes.go:45–60  ·  view source on GitHub ↗

AppendArrayHeader appends an array header with the given size to the slice

(b []byte, sz uint32)

Source from the content-addressed store, hash-verified

43// AppendArrayHeader appends an array header with
44// the given size to the slice
45func AppendArrayHeader(b []byte, sz uint32) []byte {
46 switch {
47 case sz <= 15:
48 return append(b, wfixarray(uint8(sz)))
49
50 case sz <= math.MaxUint16:
51 o, n := ensure(b, 3)
52 prefixu16(o[n:], marray16, uint16(sz))
53 return o
54
55 default:
56 o, n := ensure(b, 5)
57 prefixu32(o[n:], marray32, sz)
58 return o
59 }
60}
61
62// AppendNil appends a 'nil' byte to the slice
63func AppendNil(b []byte) []byte { return append(b, mnil) }

Callers 15

MarshalMsgMethod · 0.92
MarshalMsgMethod · 0.92
MarshalMsgMethod · 0.92
MarshalMsgMethod · 0.92
MarshalMsgMethod · 0.92
MarshalMsgMethod · 0.92
MarshalMsgMethod · 0.92
MarshalMsgMethod · 0.92
MarshalMsgMethod · 0.92
MarshalMsgMethod · 0.92
MarshalMsgMethod · 0.92
MarshalMsgMethod · 0.92

Calls 4

wfixarrayFunction · 0.85
prefixu16Function · 0.85
prefixu32Function · 0.85
ensureFunction · 0.70

Used in the wild real call sites across dependent graphs

searching dependent graphs…