small clean up (the compiler did this optimization anyway)

This commit is contained in:
Christian Kroll 2011-03-11 14:36:55 +00:00
parent 681c603da5
commit 7e40c0df5c
1 changed files with 3 additions and 1 deletions

View File

@ -128,11 +128,13 @@ static cell_t getcell(field_t pf, coord_t x, coord_t y){
uint8_t countsurroundingalive(field_t pf, coord_t x, coord_t y){ uint8_t countsurroundingalive(field_t pf, coord_t x, coord_t y){
static int8_t const offset[] = {-1, -1, 0, +1, +1, +1, 0, -1, -1, -1}; static int8_t const offset[] = {-1, -1, 0, +1, +1, +1, 0, -1, -1, -1};
x += XSIZE;
y += YSIZE;
uint8_t i, ret=0; uint8_t i, ret=0;
for (i = 8; i--;) for (i = 8; i--;)
{ {
// getcell(...) returns either 0 or 1 // getcell(...) returns either 0 or 1
ret += getcell(pf,(XSIZE+x+offset[i+2])%XSIZE, (YSIZE+y+offset[i])%YSIZE); ret += getcell(pf,(x+offset[i+2])%XSIZE, (y+offset[i])%YSIZE);
} }
return ret; return ret;