Set bit of the number value by SIG.
(0 is right, 30 is left) 31 is sign bit.
bit-write(number)
@/bit-write(number)
Set bit of the number value by SIG.
(0 is right, 30 is left) 31 is sign bit.
SIGboolean
State of the bit.
INnumber
Input number. Interpreted as a signed 32-bit interger
Nnumber
Input number. Interpreted as a signed 32-bit interger
OUTnumber
To use the node in your project you should have the koadrobot/arduino 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 disablestruct State {};{{ GENERATED_CODE }}voidevaluate(Context ctx){
int32_t x =(int32_t)getValue<input_IN>(ctx);
int32_t n =(int32_t)getValue<input_N>(ctx);
n =(n>0)?((n<30)? n :30):0;
n=1<< n;if(getValue<input_SIG>(ctx))
emitValue<output_OUT>(ctx, x | n);else
emitValue<output_OUT>(ctx, x &~n);}