From 77909af0c5a4a83945795ad96a8f9c77943f2b32 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Wed, 16 Jun 2021 12:01:29 +0200 Subject: [PATCH] Space is ArrowArray_t --- include/base.h | 8 ++++---- src/main.c | 11 +++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/include/base.h b/include/base.h index 951a8b7..50d4c29 100644 --- a/include/base.h +++ b/include/base.h @@ -34,12 +34,12 @@ struct { int x; int y; int z; - int xmax; - int ymax; - int zmax; } typedef Arrow_t; struct { + int xmax; + int ymax; + int zmax; size_t size; Arrow_t *space; } typedef ArrowArray_t; //XXX @@ -59,7 +59,7 @@ struct { // struct { - IntArray_t *globalDrawingSpace; + ArrowArray_t *globalDrawingSpace; IntArray_t *transitionsTree; ArrowArray_t *arrowList; int nmaxThread; diff --git a/src/main.c b/src/main.c index 93a1f92..fc8ea89 100644 --- a/src/main.c +++ b/src/main.c @@ -48,18 +48,21 @@ int main(int argc, char **argv) // scheduler0 = (Scheduler_t*) calloc(1, sizeof(Scheduler_t)); - scheduler0->globalDrawingSpace = (IntArray_t*) calloc(1, sizeof(IntArray_t)); + scheduler0->globalDrawingSpace = + (ArrowArray_t*) calloc(1, sizeof(IntArray_t)); scheduler0->globalDrawingSpace->space = - (int*) calloc(SPACE_SIZE, sizeof(int)); + (Arrow_t*) calloc(SPACE_SIZE, sizeof(Arrow_t)); scheduler0->globalDrawingSpace->size = SPACE_SIZE; scheduler0->arrowList = (ArrowArray_t*) calloc(1, sizeof(ArrowArray_t)); - scheduler0->arrowList->space = (Arrow_t*) calloc(ARROW_NUMBER, sizeof(Arrow_t)); + scheduler0->arrowList->space = + (Arrow_t*) calloc(ARROW_NUMBER, sizeof(Arrow_t)); scheduler0->arrowList->size = ARROW_NUMBER; printLog("Populating a random arrow list...\n"); for (int i = 0; i < ARROW_NUMBER; i++) { - scheduler0->arrowList->space[i].x = rand() % SPACE_SIZE; + scheduler0->arrowList->space[i].x = + rand() % scheduler0->globalDrawingSpace->xmax; scheduler0->arrowList->space[i].y = rand() % SPACE_SIZE; scheduler0->arrowList->space[i].z = rand() % SPACE_SIZE; }