From: Florian Forster Date: Wed, 11 Mar 2009 08:12:18 +0000 (+0100) Subject: src/sn_network.c: Fix a bug in sn_network_normalize. X-Git-Tag: v1.0.0~81 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=79789cfc25a65312d8b91000abc7eb9209322555;p=sort-networks.git src/sn_network.c: Fix a bug in sn_network_normalize. --- diff --git a/src/sn_network.c b/src/sn_network.c index 6308b90..cd5835e 100644 --- a/src/sn_network.c +++ b/src/sn_network.c @@ -303,7 +303,7 @@ int sn_network_normalize (sn_network_t *n) /* {{{ */ { int i; - for (i = n->stages_num - 1; i >= 0; i--) + for (i = 0; i < n->stages_num; i++) { sn_stage_t *s; int j; @@ -325,8 +325,11 @@ int sn_network_normalize (sn_network_t *n) /* {{{ */ { int k; - for (k = i; k >= 0; k--) + for (k = i; k < n->stages_num; k++) sn_stage_swap (n->stages[k], min, max); + + i = -1; + break; /* for (j) */ } } /* for (j = 0 .. #comparators) */ } /* for (i = n->stages_num - 1 .. 0) */