Changeset 38986 for trunk/Ohana/src/libohana/src/sorts.c
- Timestamp:
- Oct 27, 2015, 4:49:06 PM (11 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/libohana/src/sorts.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
-
Property svn:mergeinfo
set to
/branches/eam_branches/ipp-20150625/Ohana merged eligible
-
Property svn:mergeinfo
set to
-
trunk/Ohana/src/libohana/src/sorts.c
r33963 r38986 27 27 } 28 28 29 void fsortpair (float *X, float *Y, int N) {29 void isort (int *value, int N) { 30 30 31 # define SWAPFUNC(A,B){ float tmp; \ 31 # define SWAPFUNC(A,B){ int tmp = value[A]; value[A] = value[B]; value[B] = tmp; } 32 # define COMPARE(A,B)(value[A] < value[B]) 33 34 OHANA_SORT (N, COMPARE, SWAPFUNC); 35 36 # undef SWAPFUNC 37 # undef COMPARE 38 39 } 40 41 void dsortpair (double *X, double *Y, int N) { 42 43 # define SWAPFUNC(A,B){ double tmp; \ 32 44 tmp = X[A]; X[A] = X[B]; X[B] = tmp; \ 33 45 tmp = Y[A]; Y[A] = Y[B]; Y[B] = tmp; \ … … 42 54 } 43 55 44 void dsortpair (double *X, double*Y, int N) {56 void fsortpair (float *X, float *Y, int N) { 45 57 46 # define SWAPFUNC(A,B){ doubletmp; \58 # define SWAPFUNC(A,B){ float tmp; \ 47 59 tmp = X[A]; X[A] = X[B]; X[B] = tmp; \ 48 60 tmp = Y[A]; Y[A] = Y[B]; Y[B] = tmp; \ … … 89 101 } 90 102 103 void dsortthree (double *X, double *Y, double *Z, int N) { 104 105 # define SWAPFUNC(A,B){ double tmp; \ 106 tmp = X[A]; X[A] = X[B]; X[B] = tmp; \ 107 tmp = Y[A]; Y[A] = Y[B]; Y[B] = tmp; \ 108 tmp = Z[A]; Z[A] = Z[B]; Z[B] = tmp; \ 109 } 110 # define COMPARE(A,B)(X[A] < X[B]) 111 112 OHANA_SORT (N, COMPARE, SWAPFUNC); 113 114 # undef SWAPFUNC 115 # undef COMPARE 116 117 } 118 91 119 void fsortthree (float *X, float *Y, float *Z, int N) { 92 120 … … 105 133 } 106 134 107 void dsort three (double *X, double *Y, double *Z, int N) {135 void dsortfour (double *X, double *Y, double *Z, double *W, int N) { 108 136 109 137 # define SWAPFUNC(A,B){ double tmp; \ … … 111 139 tmp = Y[A]; Y[A] = Y[B]; Y[B] = tmp; \ 112 140 tmp = Z[A]; Z[A] = Z[B]; Z[B] = tmp; \ 141 tmp = W[A]; W[A] = W[B]; W[B] = tmp; \ 113 142 } 114 143 # define COMPARE(A,B)(X[A] < X[B]) … … 138 167 } 139 168 140 void dsortfour (double *X, double *Y, double *Z, double*W, int N) {169 void isortfour (int *X, int *Y, int *Z, int *W, int N) { 141 170 142 # define SWAPFUNC(A,B){ doubletmp; \171 # define SWAPFUNC(A,B){ int tmp; \ 143 172 tmp = X[A]; X[A] = X[B]; X[B] = tmp; \ 144 173 tmp = Y[A]; Y[A] = Y[B]; Y[B] = tmp; \ … … 154 183 155 184 } 185
Note:
See TracChangeset
for help on using the changeset viewer.
