MCPcopy
hub / github.com/tinylib/msgp / ReadInt16Bytes

Function ReadInt16Bytes

msgp/read_bytes.go:550–556  ·  view source on GitHub ↗

ReadInt16Bytes tries to read an int16 from 'b' and return the value and the remaining bytes. Possible errors: - [ErrShortBytes] (too few bytes) - [TypeError] (not a int) - [IntOverflow] (value doesn't fit in int16)

(b []byte)

Source from the content-addressed store, hash-verified

548// - [TypeError] (not a int)
549// - [IntOverflow] (value doesn't fit in int16)
550func ReadInt16Bytes(b []byte) (int16, []byte, error) {
551 i, o, err := ReadInt64Bytes(b)
552 if i > math.MaxInt16 || i < math.MinInt16 {
553 return 0, o, IntOverflow{Value: i, FailedBitsize: 16}
554 }
555 return int16(i), o, err
556}
557
558// ReadInt8Bytes tries to read an int16
559// from 'b' and return the value and the remaining bytes.

Callers 4

UnmarshalMsgMethod · 0.92
UnmarshalMsgMethod · 0.92
FuzzReadBytesFunction · 0.85

Calls 1

ReadInt64BytesFunction · 0.85

Tested by 2

FuzzReadBytesFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…