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)
| 548 | // - [TypeError] (not a int) |
| 549 | // - [IntOverflow] (value doesn't fit in int16) |
| 550 | func 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. |
searching dependent graphs…