Decode a 4-byte string into a 32-bit signed integer @param data: byte array of size 4 that represents the integer @param return: decoded integer
(data)
| 40 | |
| 41 | |
| 42 | def decode_int32(data): |
| 43 | """ |
| 44 | Decode a 4-byte string into a 32-bit signed integer |
| 45 | @param data: byte array of size 4 that represents the integer |
| 46 | @param return: decoded integer |
| 47 | """ |
| 48 | if isinstance(data, bytearray): |
| 49 | data = array.array('B', data) |
| 50 | return struct.unpack('<i', data)[0] |
| 51 | |
| 52 | |
| 53 | def encode_int16(number): |
nothing calls this directly
no outgoing calls
no test coverage detected