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

Method decodeInt32

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

Source from the content-addressed store, hash-verified

97}
98
99func (d decoder) decodeInt32(b []byte, p unsafe.Pointer) ([]byte, error) {
100 if hasNullPrefix(b) {
101 return b[4:], nil
102 }
103
104 v, r, err := d.parseInt(b, int32Type)
105 if err != nil {
106 return r, err
107 }
108
109 if v < math.MinInt32 || v > math.MaxInt32 {
110 return r, unmarshalOverflow(b[:len(b)-len(r)], int32Type)
111 }
112
113 *(*int32)(p) = int32(v)
114 return r, nil
115}
116
117func (d decoder) decodeInt64(b []byte, p unsafe.Pointer) ([]byte, error) {
118 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