Changeset 38580
- Timestamp:
- Jul 7, 2015, 11:20:45 PM (11 years ago)
- Location:
- branches/eam_branches/ipp-20150625/Ohana/src/libohana
- Files:
-
- 2 edited
-
include/ohana_sort.h (modified) (1 diff)
-
src/sorts.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20150625/Ohana/src/libohana/include/ohana_sort.h
r33963 r38580 67 67 void dsort (double *value, int N); 68 68 void fsort (float *value, int N); 69 void isort (int *value, int N); 70 71 void dsortpair (double *X, double *Y, int N); 69 72 void fsortpair (float *X, float *Y, int N); 70 void dsortpair (double *X, double *Y, int N);71 73 void isortpair (int *X, int *Y, int N); 74 72 75 void llsortpair (off_t *X, off_t *Y, off_t N); 76 77 void dsortthree (double *X, double *Y, double *Z, int N); 73 78 void fsortthree (float *X, float *Y, float *Z, int N); 74 void dsortthree (double *X, double *Y, double *Z, int N); 79 80 void dsortfour (double *X, double *Y, double *Z, double *W, int N); 75 81 void fsortfour (float *X, float *Y, float *Z, float *W, int N); 76 void dsortfour (double *X, double *Y, double *Z, double *W, int N);77 82 78 83 #endif -
branches/eam_branches/ipp-20150625/Ohana/src/libohana/src/sorts.c
r33963 r38580 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) {141 142 # define SWAPFUNC(A,B){ double tmp; \143 tmp = X[A]; X[A] = X[B]; X[B] = tmp; \144 tmp = Y[A]; Y[A] = Y[B]; Y[B] = tmp; \145 tmp = Z[A]; Z[A] = Z[B]; Z[B] = tmp; \146 tmp = W[A]; W[A] = W[B]; W[B] = tmp; \147 }148 # define COMPARE(A,B)(X[A] < X[B])149 150 OHANA_SORT (N, COMPARE, SWAPFUNC);151 152 # undef SWAPFUNC153 # undef COMPARE154 155 }
Note:
See TracChangeset
for help on using the changeset viewer.
