return (0);
} /* }}} int sn_network_normalize */
+int sn_network_unify (sn_network_t *n) /* {{{ */
+{
+ int i;
+
+ if (n == NULL)
+ return (EINVAL);
+
+ sn_network_normalize (n);
+ sn_network_compress (n);
+
+ for (i = 0; i < n->stages_num; i++)
+ sn_stage_unify (n->stages[i]);
+
+ return (0);
+} /* }}} int sn_network_unify */
+
int sn_network_remove_input (sn_network_t *n, int input) /* {{{ */
{
int i;
*/
int sn_network_normalize (sn_network_t *n);
+int sn_network_unify (sn_network_t *n);
+
/**
* Removes an input and all comparators touching that input from the comparator
* network.
return (0);
} /* int sn_stage_shift */
+static int sn_stage_unify__qsort_callback (const void *p0, const void *p1) /* {{{ */
+{
+ return (sn_comparator_compare (p0, p1));
+} /* }}} int sn_stage_unify__qsort_callback */
+
+int sn_stage_unify (sn_stage_t *s) /* {{{ */
+{
+ if (s == NULL)
+ return (EINVAL);
+
+ qsort (s->comparators,
+ (size_t) s->comparators_num,
+ sizeof (*s->comparators),
+ sn_stage_unify__qsort_callback);
+
+ return (0);
+} /* }}} int sn_stage_unify */
+
int sn_stage_swap (sn_stage_t *s, int con0, int con1)
{
int i;
*/
int sn_stage_shift (sn_stage_t *s, int sw, int inputs_num);
+int sn_stage_unify (sn_stage_t *s);
+
/**
* Swaps two lines. This is used by the algorithm used in
* sn_network_normalize() to transform non-standard sort networks to standard