void trial_sieve(fact_obj_t* fobj) { char** filenames = (char**)malloc(100*sizeof(char*)); char* ptr, * arg = fobj->nfs_obj.filearg; int i = 0, me; if (VFLAG < 0) VFLAG = 0; while((ptr = strchr(arg, ','))) // this sort of thing is what's absolutely brilliant about C { filenames[i] = (char*)malloc(GSTR_MAXSIZE*sizeof(char)); //printf("pointer: %p\n", filenames[i]); strncpy(filenames[i++], arg, ptr-arg+1); arg = ptr + 1; } filenames[i] = (char*)malloc(GSTR_MAXSIZE*sizeof(char)); strcpy(filenames[i++], arg); me = test_sieve(fobj, filenames, i, 1); printf("test: \"%s\" is the fastest poly\n", filenames[me]); for(me = 0; me < i; me++) free(filenames[me]); free(filenames); }
int main() { void *v; int i; printf("starting sieve\n"); test_sieve("static", static_data, STATIC_SIZE); setup_vm(); test_sieve("mapped", static_data, STATIC_SIZE); for (i = 0; i < 3; ++i) { v = vmalloc(VSIZE); test_sieve("virtual", v, VSIZE); vfree(v); } return 0; }
int main(int argc, char ** argv){ test_index(); test_buff(); test_sieve(); return 0; }