Fix issues in crypto_test.c

This commit is contained in:
endoffile78 2017-01-07 11:38:31 -06:00
parent d6d14b5430
commit d41bb3a8d4
No known key found for this signature in database
GPG Key ID: 9043061421EF90FA

View File

@ -344,11 +344,14 @@ END_TEST
static int cmp(const void *a, const void *b) static int cmp(const void *a, const void *b)
{ {
if (a < b) { const clock_t *first = (const clock_t *) a;
const clock_t *second = (const clock_t *) b;
if (*first < *second) {
return -1; return -1;
} }
if (a > b) { if (*first > *second) {
return 1; return 1;
} }
@ -371,7 +374,7 @@ static clock_t memcmp_median(void *a, void *b, size_t len)
results[i] = memcmp_time(a, b, len); results[i] = memcmp_time(a, b, len);
} }
qsort(results, CRYPTO_TEST_MEMCMP_COUNT, sizeof(results), cmp); qsort(results, CRYPTO_TEST_MEMCMP_COUNT, sizeof(*results), cmp);
return results[CRYPTO_TEST_MEMCMP_COUNT / 2]; return results[CRYPTO_TEST_MEMCMP_COUNT / 2];
} }