encode_SHORT function
dynamic
encode_SHORT(
- dynamic v
Convert a 16-bit signed integer to a list of 2 bytes. @param {number} @returns {Array}
Implementation
encode_SHORT(v) {
// Two's complement
if (v >= LIMIT16) {
v = -(2 * LIMIT16 - v);
}
return [(v >> 8) & 0xFF, v & 0xFF];
}