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

Method decodeUint8

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

Source from the content-addressed store, hash-verified

157}
158
159func (d decoder) decodeUint8(b []byte, p unsafe.Pointer) ([]byte, error) {
160 if hasNullPrefix(b) {
161 return b[4:], nil
162 }
163
164 v, r, err := d.parseUint(b, uint8Type)
165 if err != nil {
166 return r, err
167 }
168
169 if v > math.MaxUint8 {
170 return r, unmarshalOverflow(b[:len(b)-len(r)], uint8Type)
171 }
172
173 *(*uint8)(p) = uint8(v)
174 return r, nil
175}
176
177func (d decoder) decodeUint16(b []byte, p unsafe.Pointer) ([]byte, error) {
178 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