From 7e40c0df5cbfd3bfd84bc3358cf0fc711802942b Mon Sep 17 00:00:00 2001 From: Christian Kroll Date: Fri, 11 Mar 2011 14:36:55 +0000 Subject: [PATCH] small clean up (the compiler did this optimization anyway) --- animations/gameoflife.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/animations/gameoflife.c b/animations/gameoflife.c index 7d04690..a6c93e3 100644 --- a/animations/gameoflife.c +++ b/animations/gameoflife.c @@ -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){ static int8_t const offset[] = {-1, -1, 0, +1, +1, +1, 0, -1, -1, -1}; + x += XSIZE; + y += YSIZE; uint8_t i, ret=0; for (i = 8; i--;) { // 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;