number-to-i16

xod/bits/number-to-i16

Converts number to a 16-bit signed integer presented as 2 bytes. An input for the the conversion should be between -32768.00 and 32767.00.
number-to-i16
@/number-to-i16
Converts number to a 16-bit signed integer presented as 2 bytes. An input for the the conversion should be between -32768.00 and 32767.00.
INnumber
number-to-i16
IN
B1
B0
B0byte
Least significant byte
B1byte
Most significant byte

C++ implementation

node {
    void evaluate(Context ctx) {
        int16_t input = getValue<input_IN>(ctx);
        uint8_t b1 = input >> 8;
        uint8_t b0 = input;
        emitValue<output_B0>(ctx, b0);
        emitValue<output_B1>(ctx, b1);
    }
}

Tabular tests

INB1B0
32767.007FhFFh
-32768.0080h00h
00h0.00
-1.00FFh