void part1(void) { int a,b; b=count-6; if(b<0) b=0; else if(b>63) b=63; b=b*3+16*3; pal[-3*4+pal1colp*3+1*3+0]=pal1[0*3+b+0]; pal[-3*4+pal1colp*3+1*3+1]=pal1[0*3+b+1]; pal[-3*4+pal1colp*3+1*3+2]=pal1[0*3+b+2]; pal[-3*4+pal1colp*3+2*3+0]=pal1[64*3+b+0]; pal[-3*4+pal1colp*3+2*3+1]=pal1[64*3+b+1]; pal[-3*4+pal1colp*3+2*3+2]=pal1[64*3+b+2]; pal[-3*4+pal1colp*3+3*3+0]=pal1[128*3+b+0]; pal[-3*4+pal1colp*3+3*3+1]=pal1[128*3+b+1]; pal[-3*4+pal1colp*3+3*3+2]=pal1[128*3+b+2]; b=(64-(count>64?64:count))*3+16*3; pal[pal1colp*3+1*3+0]=pal1[0*3+b+0]; pal[pal1colp*3+1*3+1]=pal1[0*3+b+1]; pal[pal1colp*3+1*3+2]=pal1[0*3+b+2]; pal[pal1colp*3+2*3+0]=pal1[64*3+b+0]; pal[pal1colp*3+2*3+1]=pal1[64*3+b+1]; pal[pal1colp*3+2*3+2]=pal1[64*3+b+2]; pal[pal1colp*3+3*3+0]=pal1[128*3+b+0]; pal[pal1colp*3+3*3+1]=pal1[128*3+b+1]; pal[pal1colp*3+3*3+2]=pal1[128*3+b+2]; loadpal(pal,32*3); if(count<8) for(a=0;a<2048/8;a++) { dotsp+=4; switch(dotspnt[dotsp]) { case 1 : doit1(dotspnt[dotsp+2],dotspnt[dotsp+3],3+pal1colp); break; case 2 : doit1(dotspnt[dotsp+2],dotspnt[dotsp+3],2+pal1colp); break; case 3 : doit1(dotspnt[dotsp+2],dotspnt[dotsp+3],1+pal1colp); break; default : dotsp=0; break; } } else if(count>=72) NEXTMODE; }
int main(int argc, char *argv[]) { int ch; int mode; mode = 1; while ((ch = getopt(argc, argv, "123")) != EOF) { switch (ch) { case '1': mode = 1; break; case '2': mode = 2; break; case '3': mode = 3; break; default: exit(1); } } argc -= optind; argv += optind; switch (mode) { case 1: doit1(argv); break; case 2: doit2(argv); break; case 3: doit3(argv); break; } return 0; }
/* This tester measures the performance of a number of miscellaneous GASNet functions that don't involve actual communication, to assist in evaluating the overhead of the GASNet layer itself */ int main(int argc, char **argv) { gasnet_handlerentry_t htable[] = { { hidx_null_shorthandler, null_shorthandler }, { hidx_justreply_shorthandler, justreply_shorthandler }, { hidx_null_medhandler, null_medhandler }, { hidx_justreply_medhandler, justreply_medhandler }, { hidx_null_longhandler, null_longhandler }, { hidx_justreply_longhandler, justreply_longhandler } }; GASNET_Safe(gasnet_init(&argc, &argv)); GASNET_Safe(gasnet_attach(htable, sizeof(htable)/sizeof(gasnet_handlerentry_t), TEST_SEGSZ_REQUEST, TEST_MINHEAPOFFSET)); test_init("testmisc",1,"(iters) (accuracy_digits) (test_sections)"); mynode = gasnet_mynode(); myseg = TEST_MYSEG(); if (argc > 1) iters = atoi(argv[1]); if (!iters) iters = 100000; if (argc > 2) accuracy = atoi(argv[2]); if (!accuracy) accuracy = 3; if (argc > 3) TEST_SECTION_PARSE(argv[3]); if (argc > 4) test_usage(); if (mynode == 0) { printf("Running misc performance test with %i iterations...\n",iters); printf("%-50s Total time Avg. time\n" "%-50s ---------- ---------\n", "", ""); fflush(stdout); } doit1(); MSG("done."); gasnet_exit(0); return 0; }
network code(){ switch(line){ case THING1: doit1(); break; case THING2: if(x == STUFF){ do_first_stuff(); if(y == OTHER_STUFF) break; do_later_stuff(); } initialize_modes_pointer(); break; default: processing(); } use_modes_pointer(); }