summaryrefslogtreecommitdiff
path: root/src/c/auxiliaryFunctions/find/sfinda.c
diff options
context:
space:
mode:
authorjofret2010-07-16 22:47:53 +0000
committerjofret2010-07-16 22:47:53 +0000
commite3724c71f70b0349950996d30575f155e9deb3a9 (patch)
tree9dd35d6a7831a3be3d25a5e06fc8f21152871e55 /src/c/auxiliaryFunctions/find/sfinda.c
parent63c58ca04a24d7016b5301d28193895272e61799 (diff)
downloadscilab2c-e3724c71f70b0349950996d30575f155e9deb3a9.tar.gz
scilab2c-e3724c71f70b0349950996d30575f155e9deb3a9.tar.bz2
scilab2c-e3724c71f70b0349950996d30575f155e9deb3a9.zip
Correct FIND function prototypes
Diffstat (limited to 'src/c/auxiliaryFunctions/find/sfinda.c')
-rw-r--r--src/c/auxiliaryFunctions/find/sfinda.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/src/c/auxiliaryFunctions/find/sfinda.c b/src/c/auxiliaryFunctions/find/sfinda.c
index 73c86d37..ac445fac 100644
--- a/src/c/auxiliaryFunctions/find/sfinda.c
+++ b/src/c/auxiliaryFunctions/find/sfinda.c
@@ -12,23 +12,30 @@
#include "find.h"
-void sfinda(float* x, int size, float* out, int *indiceOut , int max ) {
- int i = 0;
-
- indiceOut[1]=0;
-
- /* if out is empty */
- out[0]=-1;
-
-
- for (i = 0; i < size ; ++i) {
- /*to avoid useless search if we only want to find the max first founded value */
- if (indiceOut[1] == max ) return ;
- if (x[i] != 0) {
- out[indiceOut[1]] = (float)(i+1);
- indiceOut[1]++;
+void sfinda(float* x, int size, float* out, int max)
+{
+ int i = 0;
+ int j = 0;
+
+
+ /* if out is empty */
+ out[0]=-1;
+
+
+ for (i = 0; i < size ; ++i)
+ {
+ /*to avoid useless search if we only want to find the max first founded value */
+ if (j == max )
+ {
+ return ;
+ }
+
+ if (x[i] != 0)
+ {
+ out[j] = (float)(i+1);
+ ++j;
+ }
}
- }
}