Skip to content

Commit

Permalink
examples: fix the variable shadowing issue in stencil tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shintaro-iwasaki committed Mar 31, 2020
1 parent f358351 commit 8192312
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions examples/stencil_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,14 @@ static int eq(double a, double b)
return (a - b < e);
}

static int check(double *results, int n)
static int check(double *r, int n)
{
int i, j;
for (i = 0; i < n / 2; i++) {
for (j = 0; j < n / 2; j++) {
if (!eq(results[i * n + j], results[i * n + (n - 1 - j)]) ||
!eq(results[i * n + j], results[(n - 1 - i) * n + j]) ||
!eq(results[i * n + j], results[(n - 1 - i) * n + (n - 1 - j)]))
if (!eq(r[i * n + j], r[i * n + (n - 1 - j)]) ||
!eq(r[i * n + j], r[(n - 1 - i) * n + j]) ||
!eq(r[i * n + j], r[(n - 1 - i) * n + (n - 1 - j)]))
return 0;
}
}
Expand Down
8 changes: 4 additions & 4 deletions examples/stencil_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ static int eq(double a, double b)
return (a - b < e);
}

static int check(double *results, int n)
static int check(double *r, int n)
{
int i, j;
for (i = 0; i < n / 2; i++) {
for (j = 0; j < n / 2; j++) {
if (!eq(results[i * n + j], results[i * n + (n - 1 - j)]) ||
!eq(results[i * n + j], results[(n - 1 - i) * n + j]) ||
!eq(results[i * n + j], results[(n - 1 - i) * n + (n - 1 - j)]))
if (!eq(r[i * n + j], r[i * n + (n - 1 - j)]) ||
!eq(r[i * n + j], r[(n - 1 - i) * n + j]) ||
!eq(r[i * n + j], r[(n - 1 - i) * n + (n - 1 - j)]))
return 0;
}
}
Expand Down
8 changes: 4 additions & 4 deletions examples/stencil_thread_cond.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,14 @@ static int eq(double a, double b)
return (a - b < e);
}

static int check(double *results, int n)
static int check(double *r, int n)
{
int i, j;
for (i = 0; i < n / 2; i++) {
for (j = 0; j < n / 2; j++) {
if (!eq(results[i * n + j], results[i * n + (n - 1 - j)]) ||
!eq(results[i * n + j], results[(n - 1 - i) * n + j]) ||
!eq(results[i * n + j], results[(n - 1 - i) * n + (n - 1 - j)]))
if (!eq(r[i * n + j], r[i * n + (n - 1 - j)]) ||
!eq(r[i * n + j], r[(n - 1 - i) * n + j]) ||
!eq(r[i * n + j], r[(n - 1 - i) * n + (n - 1 - j)]))
return 0;
}
}
Expand Down

0 comments on commit 8192312

Please sign in to comment.