shift-1-bit

nazarijtipusak080/work-with-bit/shift-1-bit

No description
shift-1-bit
@/shift-1-bit
bitboolean
Nnumber
Shift bits count. Truncated to an integer. Negative values round to zero
shift-1-bit
OUT
bit
N
OUTbyte
To use the node in your project you should have the nazarijtipusak080/work-with-bit 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) {
        uint8_t x = (int8_t)getValue<input_bit>(ctx);
        uint8_t n = (int8_t)getValue<input_N>(ctx);
        uint8_t b = 0;
        if (n > 7) {
          b = 7;
        } else {
          b = n;
        }
        emitValue<output_OUT>(ctx, x << b);
    }
}