Sunday, April 8, 2018

c - SSE operations to implement a loop over a 2D array where each output depends on the 3x3 square that contains it (Game of Life)

I need to implement SSE (vector operations) to this C module, but cannot reach enough information of this technology, any clue or solution for this?




Also, i'm listening if you have any tips for the code here.



void evolution(void *u, int w, int h){

//check_args(c, v);

unsigned (*univ)[w] = u;
unsigned new[h][w];
int itis = args.ITERATIONS;

int actualIteration = 0;

while(itis>0){

int thisGenerationSeeds = 0;

for(int y=0;y for(int x=0;x int n = 0;
for(int y1=y-1;y1<=y+1;y1++){

for(int x1=x-1;x1<=x+1;x1++){
if(univ[(y1+h)%h][(x1+w)%w]){
n++;
thisGenerationSeeds++;
}
}
}
if(univ[y][x]==1){
n--;
}

new[y][x] = (n==3 || (n==2 && univ[y][x]));
//thisGenerationSeeds++ = (n==3 || (n==2 && univ[y][x]));

}
}
itis--;
actualIteration++;

printf("\nIteration:_%d, \n Sec Living Seeds:_%d,\n Par Living Seeds:,\n Vec Living Seeds%d",actualIteration, thisGeneration
}

for(int y=0;y for(int x=0;x univ[y][x] = new[y][x];
}
}


}

No comments:

Post a Comment

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...