ReadInt8Bytes 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 int8)
(b []byte)
| 564 | // - [TypeError] (not a int) |
| 565 | // - [IntOverflow] (value doesn't fit in int8) |
| 566 | func ReadInt8Bytes(b []byte) (int8, []byte, error) { |
| 567 | i, o, err := ReadInt64Bytes(b) |
| 568 | if i > math.MaxInt8 || i < math.MinInt8 { |
| 569 | return 0, o, IntOverflow{Value: i, FailedBitsize: 8} |
| 570 | } |
| 571 | return int8(i), o, err |
| 572 | } |
| 573 | |
| 574 | // ReadIntBytes tries to read an int |
| 575 | // from 'b' and return the value and the remaining bytes. |
searching dependent graphs…