MCPcopy Create free account
hub / github.com/segmentio/encoding / decodeUint16

Method decodeUint16

json/decode.go:177–193  ·  view source on GitHub ↗
(b []byte, p unsafe.Pointer)

Source from the content-addressed store, hash-verified

175}
176
177func (d decoder) decodeUint16(b []byte, p unsafe.Pointer) ([]byte, error) {
178 if hasNullPrefix(b) {
179 return b[4:], nil
180 }
181
182 v, r, err := d.parseUint(b, uint16Type)
183 if err != nil {
184 return r, err
185 }
186
187 if v > math.MaxUint16 {
188 return r, unmarshalOverflow(b[:len(b)-len(r)], uint16Type)
189 }
190
191 *(*uint16)(p) = uint16(v)
192 return r, nil
193}
194
195func (d decoder) decodeUint32(b []byte, p unsafe.Pointer) ([]byte, error) {
196 if hasNullPrefix(b) {

Callers

nothing calls this directly

Calls 3

parseUintMethod · 0.95
hasNullPrefixFunction · 0.85
unmarshalOverflowFunction · 0.85

Tested by

no test coverage detected