bin4_to_int

Reads the boolean inputs as 4-bit binary, and outputs the corresponding int (0-15)
Author: Jeppe Rasmussen
License: BSD
Github: klab/decode/bin4_to_int.axo

Inlets

bool32 i0

bool32 i1

bool32 i2

bool32 i3

Outlets

int32.positive o0

Declaration
int result;
Control Rate
result = 0;
if (inlet_i0 != 0) {
  result = result + 1;
}
if (inlet_i1 != 0) {
  result = result + 2;
}
if (inlet_i2 != 0) {
  result = result + 4;
}
if (inlet_i3 != 0) {
  result = result + 8;
}

outlet_o0 = result;

Privacy

© 2024 Zrna Research