Bug fix: sizes array wasn't updating with ARRAY_SIZE argument

sizes array was fixed at compile time not run time.
Moved the declaration to the correct scope.
This commit is contained in:
Tom Deakin 2015-07-27 13:44:07 +01:00
parent c3ad5edcb3
commit a74e7cee4c
2 changed files with 12 additions and 13 deletions

View File

@ -40,13 +40,6 @@ struct badntimes : public std::exception
} }
}; };
size_t sizes[4] = {
2 * DATATYPE_SIZE * ARRAY_SIZE,
2 * DATATYPE_SIZE * ARRAY_SIZE,
3 * DATATYPE_SIZE * ARRAY_SIZE,
3 * DATATYPE_SIZE * ARRAY_SIZE
};
void check_solution(void* a, void* b, void* c) void check_solution(void* a, void* b, void* c)
{ {
// Generate correct solution // Generate correct solution
@ -279,6 +272,12 @@ int main(int argc, char *argv[])
check_solution(h_a, h_b, h_c); check_solution(h_a, h_b, h_c);
// Crunch results // Crunch results
size_t sizes[4] = {
2 * DATATYPE_SIZE * ARRAY_SIZE,
2 * DATATYPE_SIZE * ARRAY_SIZE,
3 * DATATYPE_SIZE * ARRAY_SIZE,
3 * DATATYPE_SIZE * ARRAY_SIZE
};
double min[4] = {DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX}; double min[4] = {DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX};
double max[4] = {0.0, 0.0, 0.0, 0.0}; double max[4] = {0.0, 0.0, 0.0, 0.0};
double avg[4] = {0.0, 0.0, 0.0, 0.0}; double avg[4] = {0.0, 0.0, 0.0, 0.0};

View File

@ -49,12 +49,6 @@ struct badntimes : public std::exception
} }
}; };
size_t sizes[4] = {
2 * DATATYPE_SIZE * ARRAY_SIZE,
2 * DATATYPE_SIZE * ARRAY_SIZE,
3 * DATATYPE_SIZE * ARRAY_SIZE,
3 * DATATYPE_SIZE * ARRAY_SIZE
};
void check_solution(void* a, void* b, void* c) void check_solution(void* a, void* b, void* c)
{ {
@ -288,6 +282,12 @@ int main(int argc, char *argv[])
check_solution(h_a, h_b, h_c); check_solution(h_a, h_b, h_c);
// Crunch results // Crunch results
size_t sizes[4] = {
2 * DATATYPE_SIZE * ARRAY_SIZE,
2 * DATATYPE_SIZE * ARRAY_SIZE,
3 * DATATYPE_SIZE * ARRAY_SIZE,
3 * DATATYPE_SIZE * ARRAY_SIZE
};
double min[4] = {DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX}; double min[4] = {DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX};
double max[4] = {0.0, 0.0, 0.0, 0.0}; double max[4] = {0.0, 0.0, 0.0, 0.0};
double avg[4] = {0.0, 0.0, 0.0, 0.0}; double avg[4] = {0.0, 0.0, 0.0, 0.0};