1
0
mirror of https://github.com/nfc-tools/mfoc.git synced 2026-01-11 23:43:21 +00:00

Fix compar_int

'uint64_t' - 'uint64_t' may overflow return type int.
cf https://stackoverflow.com/questions/36681906/c-qsort-doesnt-seem-to-work-with-unsigned-long
Thanks @xianglin1998 !
This commit is contained in:
Philippe Teuwen 2023-11-15 12:17:21 +01:00
parent ba072f16f6
commit a5a4c9184d

View File

@ -1198,7 +1198,9 @@ uint32_t median(denonce d)
int compar_int(const void *a, const void *b)
{
return (*(uint64_t *)b - * (uint64_t *)a);
if (*(uint64_t *)b == *(uint64_t *)a) return 0;
if (*(uint64_t *)b < * (uint64_t *)a) return 1;
return -1;
}
// Compare countKeys structure