/* 1 -1 non-zero if majority of defined cells are non-zero */ #define MAJORITY_HIGH i[0] #define MAJORITY_TOTAL i[1] static void rf_majority_callback( Data *d) { ++d->MAJORITY_TOTAL; if( d->list_val) ++d->MAJORITY_HIGH; } double rf_majority(const Node *n, const Cell *c) { Data d; d.MAJORITY_HIGH = d.MAJORITY_TOTAL = 0; ss_traverse_list( Right(n), c, rf_majority_callback, &d); return (d.MAJORITY_HIGH > (d.MAJORITY_TOTAL / 2) ); }