to-byte(boolean8)

koadrobot/casts/to-byte(boolean8)

Return Byte (binary form) of Boolean inputs.
to-byte(boolean8)
@/to-byte(boolean8)
Return Byte (binary form) of Boolean inputs.
Q7boolean
State of the 7 Bit of Byte.
Q6boolean
State of the 6 Bit of Byte.
Q5boolean
State of the 5 Bit of Byte.
Q4boolean
State of the 4 Bit of Byte.
Q3boolean
State of the 3 Bit of Byte.
Q2boolean
State of the 2 Bit of Byte.
Q1boolean
State of the 1 Bit of Byte.
Q0boolean
State of the Zero Bit of Byte.
to-byte(boolean8)
OUT
Q7
Q6
Q5
Q4
Q3
Q2
Q1
Q0
OUTbyte
Binary form of Booleans
To use the node in your project you should have the koadrobot/casts 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

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) 
{
    emitValue<output_OUT>(ctx,  (getValue<input_Q0>(ctx) << 0) | 
                                (getValue<input_Q1>(ctx) << 1) | 
                                (getValue<input_Q2>(ctx) << 2) | 
                                (getValue<input_Q3>(ctx) << 3) | 
                                (getValue<input_Q4>(ctx) << 4) | 
                                (getValue<input_Q5>(ctx) << 5) | 
                                (getValue<input_Q6>(ctx) << 6) | 
                                (getValue<input_Q7>(ctx) << 7) );
}

Tabular tests

Q7Q6Q5Q4Q3Q2Q1Q0OUT
falsefalsefalsefalsefalsefalsefalsefalse0
truetruetruetruetruetruetruetrue255