Converts 16-bit signed integer presented as two bytes to a number. A result of the conversion will be between -32768.00 and 32767.00.
i16-to-number
@/i16-to-number
Converts 16-bit signed integer presented as two bytes to a number. A result of the conversion will be between -32768.00 and 32767.00.
node {
void evaluate(Context ctx) {
uint8_t b1 = getValue<input_B1>(ctx);
uint8_t b0 = getValue<input_B0>(ctx);
int16_t bytes = ((b1 << 8) | b0);
Number result = (Number)bytes;
emitValue<output_OUT>(ctx, result);
}
}
B1 | B0 | OUT |
7Fh | FFh | 32767.00 |
80h | 00h | -32768.00 |
00h | 00h | 0.00 |
FFh | FFh | -1.00 |