getShort static method
Converts two bytes of a byte array to a signed 16-bit integer.
The byte order is big-endian.
Implementation
static int getShort(Uint8List buffer, int offset) {
assert(buffer.length >= offset + 2);
if (buffer[offset] & 0x80 > 0) {
return -1 * (((buffer[offset] & 0x7f) ^ 0x7f) << 8 | ((buffer[offset + 1] & 0xff) ^ 0xff) + 1);
}
return buffer[offset] << 8 | (buffer[offset + 1] & 0xff);
}