Skip to content

Commit

Permalink
[pthread] CalcDoA 부분 최적화
Browse files Browse the repository at this point in the history
Loop Unrolling으로 부분 최적화
  • Loading branch information
ptptptpts committed Apr 10, 2014
1 parent 019524f commit 37e0891
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion pthreads/game_of_life_pthreads.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

//#define __TESTINPUT
//#define __TESTPOOL
//#define __NOOUTPUT
#define __NOOUTPUT

#define __BASIC
//#define __TESTMUTEX
Expand Down Expand Up @@ -836,10 +836,28 @@ int CalcDoA (int x, int y, int z)
// 살아있는 세포 갯수 체크
for (i = 0 ; i < zRep; i++) {
for (j = 0; j < yRep; j++) {

if (xRep == 3) {
nLiv += *pMap;
pMap++;
nLiv += *pMap;
pMap++;
nLiv += *pMap;
pMap++;
} else {
nLiv += *pMap;
pMap++;
nLiv += *pMap;
pMap++;
}

/*
for (k = 0; k < xRep; k++) {
nLiv += (int)(*pMap);
pMap++;
}
*/

pMap += _iMapSize - xRep;
}
pMap += _iMapSize * (_iMapSize - yRep);
Expand Down

0 comments on commit 37e0891

Please sign in to comment.