comparison CbC-examples/quicksort/quicksort_test.cbc @ 25:2476ed92181e

modified machine description of i386 for support indirect sibcall attributed fastcall.
author kent <kent@cr.ie.u-ryukyu.ac.jp>
date Tue, 27 Oct 2009 16:04:06 +0900
parents 775dfe898662
children 3f5886e153cb
comparison
equal deleted inserted replaced
24:f37d7058d1ce 25:2476ed92181e
3 #include<assert.h> 3 #include<assert.h>
4 #include<unistd.h> 4 #include<unistd.h>
5 5
6 #include"quicksort_test.h" 6 #include"quicksort_test.h"
7 7
8 extern __code quicksort(int *,int,int, __code(*)(void*), void*); 8 extern __code quicksort(int *,int,int, __code (*)(void*), void*);
9 9
10 10
11 void 11 void
12 random_initialize(int *v, int size, int min, int max) 12 random_initialize(int *v, int size, int min, int max)
13 { 13 {
48 goto quicksort(target, 0, size-1, exit0, (void*)target); 48 goto quicksort(target, 0, size-1, exit0, (void*)target);
49 49
50 printf("bad region\n"); 50 printf("bad region\n");
51 } 51 }
52 52
53 static int size=100;
54
53 int 55 int
54 main(int argc, char **argv) 56 main(int argc, char **argv)
55 { 57 {
56 unsigned int seed=0; 58 unsigned int seed=0;
57 int size=100;
58 int opt; 59 int opt;
59 60
60 while ((opt = getopt(argc, argv, "s:n:")) != -1) { 61 while ((opt = getopt(argc, argv, "s:n:")) != -1) {
61 switch (opt) { 62 switch (opt) {
62 case 's': 63 case 's':
90 __code 91 __code
91 exit0(void *arg) 92 exit0(void *arg)
92 { 93 {
93 int *v = arg; 94 int *v = arg;
94 int b; 95 int b;
95 //print_array(arg, 100); 96 //print_array(arg, size);
96 //b = check_sort(arg, 100); 97 b = check_sort(arg, size);
97 if (b) { 98 if (b) {
98 printf("sorting successful!\n"); 99 printf("sorting successful!\n");
99 exit(-1); 100 exit(-1);
100 } else { 101 } else {
101 printf("sorting failure! \n"); 102 printf("sorting failure! \n");