45 static int num_cmp1(
int * x,
int * y) {
return ((*x) < (*y)) ? -1 : (((*x) > (*y)) ? 1 : 0); }
46 static int num_cmp2(
int * x,
int * y) {
return (*x) < (*y); }
47 static inline void selectionsort(
int* array,
int size,
int(*comp)(
const void *,
const void *))
51 for (i = 0; i < size-1; i++){
53 for (j = i+1; j <
size; j++){
54 if (comp(array + j, array + best_i))
57 tmp = array[i]; array[i] = array[best_i]; array[best_i] = tmp;
60 static void sort_rec(
int* array,
int size,
int(*comp)(
const void *,
const void *))
65 int pivot = array[size/2];
70 do i++;
while(comp(array + i, &pivot));
71 do j--;
while(comp(&pivot, array + j));
73 tmp = array[i]; array[i] = array[j]; array[j] = tmp;
79 void minisat_sort(
int* array,
int size,
int(*comp)(
const void *,
const void *))
100 for (i = 0; i < size-1; i++){
102 for (j = i+1; j <
size; j++){
103 if (array[j] < array[best_i])
106 tmp = array[i]; array[i] = array[best_i]; array[best_i] = tmp;
114 int pivot = array[size/2];
119 do i++;
while(array[i] < pivot);
120 do j--;
while(pivot < array[j]);
122 tmp = array[i]; array[i] = array[j]; array[j] = tmp;
149 for ( i = 0; i < nSize; i++ )
156 for ( i = 1; i < nSize; i++ )
157 assert( pArray[i-1] <= pArray[i] );
161 int nSize = 100000000;
165 printf(
"Sorting %d integers\n", nSize );
168 qsort( pArray, nSize, 4, (
int (*)(
const void *,
const void *))
num_cmp1 );
204 for (i = 0; i < size-1; i++){
206 for (j = i+1; j <
size; j++){
207 if (array[j] < array[best_i])
210 tmpf = array[i]; array[i] = array[best_i]; array[best_i] = tmpf;
211 tmpi = perm[i]; perm[i] = perm[best_i]; perm[best_i] = tmpi;
214 static void sort_rec3(
float* array,
int* perm,
int size)
219 float pivot = array[size/2];
225 do i++;
while(array[i] < pivot);
226 do j--;
while(pivot < array[j]);
228 tmpf = array[i]; array[i] = array[j]; array[j] = tmpf;
229 tmpi = perm[i]; perm[i] = perm[j]; perm[j] = tmpi;
257 for ( i = 0; i < nSize; i++ )
static void selectionsort3(float *array, int *perm, int size)
static void selectionsort(int *array, int size, int(*comp)(const void *, const void *))
void minisat_sort(int *array, int size, int(*comp)(const void *, const void *))
void minisat_sort3(float *array, int *perm, int size)
#define ABC_ALLOC(type, num)
static abctime Abc_Clock()
int * Gia_SortGetTest(int nSize)
void Gia_SortVerifySorted(int *pArray, int nSize)
#define ABC_NAMESPACE_IMPL_END
#define ABC_NAMESPACE_IMPL_START
int * Gia_SortFloats(float *pArray, int *pPerm, int nSize)
void minisat_sort2(int *array, int size)
static void selectionsort2(int *array, int size)
static int num_cmp2(int *x, int *y)
static void sort_rec3(float *array, int *perm, int size)
static void sort_rec(int *array, int size, int(*comp)(const void *, const void *))
static void sort_rec2(int *array, int size)
static ABC_NAMESPACE_IMPL_START int num_cmp1(int *x, int *y)
DECLARATIONS ///.