AppendMapHeader appends a map header with the given size to the slice
(b []byte, sz uint32)
| 24 | // AppendMapHeader appends a map header with the |
| 25 | // given size to the slice |
| 26 | func AppendMapHeader(b []byte, sz uint32) []byte { |
| 27 | switch { |
| 28 | case sz <= 15: |
| 29 | return append(b, wfixmap(uint8(sz))) |
| 30 | |
| 31 | case sz <= math.MaxUint16: |
| 32 | o, n := ensure(b, 3) |
| 33 | prefixu16(o[n:], mmap16, uint16(sz)) |
| 34 | return o |
| 35 | |
| 36 | default: |
| 37 | o, n := ensure(b, 5) |
| 38 | prefixu32(o[n:], mmap32, sz) |
| 39 | return o |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | // AppendArrayHeader appends an array header with |
| 44 | // the given size to the slice |
searching dependent graphs…