commit 39ae0f1a1265076cf5e21a0ce05b1f1958f6da55
parent 66e89abd3a047607a98d2411bac9726afcdfe293
Author: Wilson Gheen <wilson@wilsonrgheen.com>
Date: Fri, 9 Dec 2022 03:46:06 -0600
Calculate copying size better
Diffstat:
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/life.c b/life.c
@@ -117,8 +117,7 @@ void play(uint32_t board[], int rows, int cols) {
print_board(board, rows, cols);
sleep(1);
uint32_t *l2 = get_next_state(board, rows, cols);
- // TODO calculate this better
- memcpy(board, l2, 32);
+ memcpy(board, l2, (sizeof *l2) * rows );
}
/* for(int i=0; i < rows; i++)*/
/* printf("row %d:\t% 6x\t(%" PRIu32 ")\n", i, BOARD[i]);*/