shithub: aubio

Download patch

ref: 9ee1ee9b78478492f5eaca0ede46bd1b21dca41e
parent: 094a8be0d528adf3a1cf669ecf9c1f9e50da10ed
author: Paul Brossier <piem@piem.org>
date: Fri Oct 30 06:33:58 EDT 2015

src/pitch/pitchmcomb.c: fix candidates sorting function, really comparing current to next

--- a/src/pitch/pitchmcomb.c
+++ b/src/pitch/pitchmcomb.c
@@ -335,8 +335,7 @@
   uint_t cur = 0;
   uint_t run = 0;
   for (cur = 0; cur < nbins; cur++) {
-    run = cur + 1;
-    for (run = cur; run < nbins; run++) {
+    for (run = cur + 1; run < nbins; run++) {
       if (candidates[run]->ene > candidates[cur]->ene)
         CAND_SWAP (candidates[run], candidates[cur]);
     }
@@ -351,8 +350,7 @@
   uint_t cur = 0;
   uint_t run = 0;
   for (cur = 0; cur < nbins; cur++) {
-    run = cur + 1;
-    for (run = cur; run < nbins; run++) {
+    for (run = cur + 1; run < nbins; run++) {
       if (candidates[run]->ebin < candidates[cur]->ebin)
         CAND_SWAP (candidates[run], candidates[cur]);
     }