diff options
| author | 2022-08-26 09:58:48 +0200 | |
|---|---|---|
| committer | 2022-08-26 09:58:48 +0200 | |
| commit | 5ba53665c99c01f407576406b4c619d180efd384 (patch) | |
| tree | 36257820de7d3d8a9cf21eee6cea9d3e38f93eda /examples | |
| parent | d42f8309b4af19966ad9c7b575918ee14421cee1 (diff) | |
some fixes + .[] syntax sugar
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/life.cff | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/life.cff b/examples/life.cff index 8b58cf4..064f88c 100644 --- a/examples/life.cff +++ b/examples/life.cff @@ -8,15 +8,15 @@ static board Board = {}; fn get(b *Board, x uint, y uint) bool { x %= W; y %= H; let idx = x + (y * W); - return (*b)[idx / 8] & (1 << (idx % 8)) != 0; + return b.[idx / 8] & (1 << (idx % 8)) != 0; } fn set(b *Board, x uint, y uint, set bool) void { x %= W; y %= H; let idx = x + (y * W); - (*b)[idx / 8] &= ~(1 << (idx % 8)); + b.[idx / 8] &= ~(1 << (idx % 8)); if set { - (*b)[idx / 8] |= (1 << (idx % 8)); + b.[idx / 8] |= (1 << (idx % 8)); } } |