From b52c98ac4341b7dd517a03631b9e191f4dfe6939 Mon Sep 17 00:00:00 2001
From: Pradeep Verghese
Date: Fri, 29 May 2020 12:15:20 +0530
Subject: [PATCH] examples: fix compilation of game_of_life due to type
mismatch
---
examples/game_of_life/modules/automaton/automaton.v | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/examples/game_of_life/modules/automaton/automaton.v b/examples/game_of_life/modules/automaton/automaton.v
index c0c622144c..aedaac16cb 100644
--- a/examples/game_of_life/modules/automaton/automaton.v
+++ b/examples/game_of_life/modules/automaton/automaton.v
@@ -46,8 +46,9 @@ fn new_automaton(f [][]int) Automaton {
maxx = f[y].len
}
}
- field := &A2D{ maxx: maxx maxy: maxy data: &int( vcalloc( sizeof(int) * maxy * maxx ) ) }
- new_field := &A2D{ maxx: maxx maxy: maxy data: &int( vcalloc( sizeof(int) * maxy * maxx ) ) }
+ size := u32(maxx * maxy)
+ field := &A2D{ maxx: maxx maxy: maxy data: &int( vcalloc( sizeof(int) * size ) ) }
+ new_field := &A2D{ maxx: maxx maxy: maxy data: &int( vcalloc( sizeof(int) * size) ) }
for y in 0..field.maxy {
for x in 0..field.maxx {
field.set( x, y, f[y][x] )