ReadInt32Bytes tries to read an int32 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 int32)
(b []byte)
| 532 | // - [TypeError] (not a int) |
| 533 | // - [IntOverflow] (value doesn't fit in int32) |
| 534 | func ReadInt32Bytes(b []byte) (int32, []byte, error) { |
| 535 | i, o, err := ReadInt64Bytes(b) |
| 536 | if i > math.MaxInt32 || i < math.MinInt32 { |
| 537 | return 0, o, IntOverflow{Value: i, FailedBitsize: 32} |
| 538 | } |
| 539 | return int32(i), o, err |
| 540 | } |
| 541 | |
| 542 | // ReadInt16Bytes tries to read an int16 |
| 543 | // from 'b' and return the value and the remaining bytes. |
searching dependent graphs…