bin8_to_int

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

Inlets

bool32 i0

bool32 i1

bool32 i2

bool32 i3

bool32 i4

bool32 i5

bool32 i6

bool32 i7

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;
}
if (inlet_i4 != 0) {
  result = result + 16;
}
if (inlet_i5 != 0) {
  result = result + 32;
}
if (inlet_i6 != 0) {
  result = result + 64;
}
if (inlet_i7 != 0) {
  result = result + 128;
}

outlet_o0 = result;

Privacy

© 2024 Zrna Research