static void calc_area() { ++iter; // sweeping mutation point static uint8_t xiter=0; static uint8_t yiter=0; xiter=(xiter+1)%RESX; if(xiter==0) yiter=(yiter+1)%RESY; bitset_set2(life,xiter+1,yiter+1,1); // remember just two columns // these don´t have to be static, so if the stack is big enoguh put them there and save another 200 bytes? static uint8_t _a[RESY+2],*left=_a; static uint8_t _b[RESY+2],*middle=_b; copy_col(0,left); copy_col(1,middle); for(uchar x=1; x<=RESX; ++x) { for(uchar y=1; y<=RESY; ++y) { uchar sum=bitset_get2(life,x+1,y-1)+bitset_get2(life,x+1,y)+bitset_get2(life,x+1,y+1)+ left[y-1]+left[y]+left[y+1]+middle[y-1]+middle[y+1]; bitset_set2(life,x,y,sum==3||(sum==2&&bitset_get2(life,x,y))); } // temp-less swap of buffer pointers left+=(uint32_t)middle; middle=left-(uint32_t)middle; left=left-(uint32_t)middle; copy_col(x+1,middle); } }
void convert_table(char *in,char *out) { TABLE src,dst; int i; if (open_table(&src,in,"I")<0) { print_error("Cannot open input file %s",in); exit_session(ERR_OPEN); } else handle_select_flag(&src,'Q',NULL); if (create_table(&dst,out,src.row,src.col,'W',src.ident)<0) { close_table(&src); print_error("Cannot create output file %s",out); exit_session(ERR_CREAT); } else { reset_print_progress(); for (i=1;i<=src.col;i++) { print_progress("Convert table: ", (int)((100*i)/src.col),1); copy_col(&src,&dst,i); } CP_non_std_desc(&src,&dst); close_table(&dst); close_table(&src); } }
//------------------------------------------------------------------------------------------------ void ImplFragmentorRepetitive::performFragmentation( const HAlignment & sample, const HAlignandum & row, const HAlignandum & col ) { /* since src1 and src2 are const, I have to create two work-copies, so that the boundaries can be changed. */ HAlignandum copy_row(row->getClone()); HAlignandum copy_col(col->getClone()); while ( 1 ) { HAlignment result = sample->getNew(); mAlignator->align( result, copy_row, copy_col ); if (result->getScore() >= mMinScore) { mFragments->push_back( result ); copy_row->mask( result->getRowFrom(), result->getRowTo() ); copy_col->mask( result->getColFrom(), result->getColTo() ); } else { break; } } }
static void compress_x (void) { int x, xm, l; for (x = 0; x < STONE_COLS; x++){ for (l = STONE_COLS; field [mapx(x)][mapy(0)].color == 0 && l; l--){ for (xm = x; xm < STONE_COLS-1; xm++) copy_col (xm, xm+1); clean_last_col (); } } }