Updated cast syntax in code samples.

This commit is contained in:
Christoffer Lerno
2021-05-18 17:23:27 +02:00
parent 216467cbf8
commit fc31c15914
50 changed files with 113 additions and 2770 deletions

View File

@@ -51,7 +51,7 @@ func void GameBoard.evolve(GameBoard *board)
}
}
if (board.world[x + y * board.w]) n--;
board.temp[x + y * board.w] = cast(n == 3 || (n == 2 && board.world[x + y * board.w]) as char);
board.temp[x + y * board.w] = (char)(n == 3 || (n == 2 && board.world[x + y * board.w]));
}
}
for (int i = 0; i < board.w * board.h; i++)
@@ -73,8 +73,8 @@ func int main(int c, char** v)
GameBoard board;
board.w = w;
board.h = h;
board.world = malloc(cast(h * w as ulong));
board.temp = malloc(cast(h * w as ulong));
board.world = malloc((ulong)(h * w));
board.temp = malloc((ulong)(h * w));
for (int i = h * w - 1; i >= 0; i--)
{