bit(number)

koadrobot/bits/bit(number)

Get Number that is N bit is set. shiftleft(1,N)
bit(number)
@/bit(number)
Get Number that is N bit is set. shiftleft(1,N)
Nnumber
pow(2, N)
bit(number)
OUT
N
OUTnumber
To use the node in your project you should have the koadrobot/bits 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

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    int32_t n = (int32_t)getValue<input_N>(ctx);
    n = (n>0) ? ((n<31) ? n : 31) : 0;
    emitValue<output_OUT>(ctx, 1 << n);
}

Tabular tests

NOUT
00
12
1128