/* Value of unused channel is 0xff, instead of 0 or 1. */
PyTuple_SetItem(py_pinvalues, i, PyLong_FromLong(0xff));
} else {
/* Value of unused channel is 0xff, instead of 0 or 1. */
PyTuple_SetItem(py_pinvalues, i, PyLong_FromLong(0xff));
} else {
byte_offset = di->dec_channelmap[i] / 8;
bit_offset = di->dec_channelmap[i] % 8;
sample = *(sample_pos + byte_offset) & (1 << bit_offset) ? 1 : 0;
byte_offset = di->dec_channelmap[i] / 8;
bit_offset = di->dec_channelmap[i] % 8;
sample = *(sample_pos + byte_offset) & (1 << bit_offset) ? 1 : 0;
if (ret == 9999) {
/* Empty condition list, automatic match. */
PyObject_SetAttrString(di->py_inst, "matched", Py_None);
if (ret == 9999) {
/* Empty condition list, automatic match. */
PyObject_SetAttrString(di->py_inst, "matched", Py_None);
if (found_match) {
/* Set self.samplenum to the (absolute) sample number that matched. */
PyObject_SetAttrString(di->py_inst, "samplenum",
if (found_match) {
/* Set self.samplenum to the (absolute) sample number that matched. */
PyObject_SetAttrString(di->py_inst, "samplenum",
/* No match, reset state for the next chunk. */
di->got_new_samples = FALSE;
di->handled_all_samples = TRUE;
/* No match, reset state for the next chunk. */
di->got_new_samples = FALSE;
di->handled_all_samples = TRUE;