From 1a64f757ede4215eea9b6a47cc22974c0e282cda Mon Sep 17 00:00:00 2001 From: Mirko Rahn Date: Tue, 13 Jun 2017 18:02:07 +0200 Subject: [PATCH] Fine grained array initialization To set every value different prevents from broken offset/size computations and gives more confidence that the algorithm is implemented correctly (which is what we need for an implementation that is so much faster) --- tutorials/default/code/solution/broadcast/broadcast_BC.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tutorials/default/code/solution/broadcast/broadcast_BC.c b/tutorials/default/code/solution/broadcast/broadcast_BC.c index d703feb..f77373d 100644 --- a/tutorials/default/code/solution/broadcast/broadcast_BC.c +++ b/tutorials/default/code/solution/broadcast/broadcast_BC.c @@ -26,7 +26,7 @@ static void init_array(int *array { for (j = 0; j < size; ++j) { - array[j] = 0; + array[j] = j; } } } @@ -42,7 +42,7 @@ static void validate(int *array for (j = 0; j < size; ++j) { - ASSERT(array[j] == 0); + ASSERT(array[j] == j); } }