i16-to-number

xod/bits/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.
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.
B1byte
Most significant byte
B0byte
Least significant byte
i16-to-number
OUT
B1
B0
OUTnumber

C++ implementation

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);
    }
}

Tabular tests

B1B0OUT
7FhFFh32767.00
80h00h-32768.00
00h00h0.00
FFhFFh-1.00