MCPcopy Index your code
hub / github.com/segmentio/encoding / decodeInt16

Method decodeInt16

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

Source from the content-addressed store, hash-verified

79}
80
81func (d decoder) decodeInt16(b []byte, p unsafe.Pointer) ([]byte, error) {
82 if hasNullPrefix(b) {
83 return b[4:], nil
84 }
85
86 v, r, err := d.parseInt(b, int16Type)
87 if err != nil {
88 return r, err
89 }
90
91 if v < math.MinInt16 || v > math.MaxInt16 {
92 return r, unmarshalOverflow(b[:len(b)-len(r)], int16Type)
93 }
94
95 *(*int16)(p) = int16(v)
96 return r, nil
97}
98
99func (d decoder) decodeInt32(b []byte, p unsafe.Pointer) ([]byte, error) {
100 if hasNullPrefix(b) {

Callers

nothing calls this directly

Calls 3

parseIntMethod · 0.95
hasNullPrefixFunction · 0.85
unmarshalOverflowFunction · 0.85

Tested by

no test coverage detected