shift-left(micros)

nazarijtipusak080/node-for-my-project/shift-left(micros)

No description
shift-left(micros)
@/shift-left(micros)
INxod/core/micros
Nnumber
Shift bits count. Truncated to an integer. Negative values round to zero
shift-left(micros)
IN
OUT
N
OUTxod/core/micros
To use the node in your project you should have the nazarijtipusak080/node-for-my-project library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

#pragma XOD dirtieness disable

node {
    void evaluate(Context ctx) {
        uint32_t x = (uint32_t)getValue<input_IN>(ctx);
        uint8_t n = (uint8_t)getValue<input_N>(ctx);
        uint8_t b = 0;
        if (n < 0) {
          b = 0;
        } else if (n > 31) {
          b = 31;
        } else {
          b = n;
        }
        emitValue<output_OUT>(ctx, x << b);
    }
}