nbit-of-xbyte

nazarijtipusak080/shift-4-bytes/nbit-of-xbyte

Outputs the nth bit belonging to the xth byte from the array as a number of type "micro".
nbit-of-xbyte
@/nbit-of-xbyte
Outputs the nth bit belonging to the xth byte from the array as a number of type "micro".
INxod/core/micros
xnumber
nnumber
nbit-of-xbyte
IN
xbyte
nbit
x
n
nbitboolean
xbytebyte
Most significant byte
To use the node in your project you should have the nazarijtipusak080/shift-4-bytes 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

node {
    void evaluate(Context ctx) {
        uint32_t val = getValue<input_IN>(ctx);
        uint8_t x = getValue<input_x>(ctx);
        uint8_t in0 = getValue<input_n>(ctx);
         uint8_t in1 = (ctx, pow( 2, in0));
        uint8_t b3 = (val >> 24);
        uint8_t b2 = (val >> 16);
        uint8_t b1 = (val >> 8);
        uint8_t b0 = val;
         uint8_t  charData[4]={b0,b1, b2, b3};
         emitValue<output_nbit>(ctx, in1 & charData[x]);
        emitValue<output_xbyte>(ctx, charData[x]);
        
    }
}