1.1 --- a/src/compare.c Sat Nov 26 16:58:41 2022 +0100 1.2 +++ b/src/compare.c Wed Dec 07 20:11:44 2022 +0100 1.3 @@ -161,9 +161,12 @@ 1.4 } 1.5 } 1.6 1.7 -int cx_cmp_double(void const *d1, void const *d2) { 1.8 - double a = *((const double*) d1); 1.9 - double b = *((const double*) d2); 1.10 +int cx_cmp_double( 1.11 + void const *d1, 1.12 + void const *d2 1.13 +) { 1.14 + double a = *((const double *) d1); 1.15 + double b = *((const double *) d2); 1.16 if (fabs(a - b) < 1e-14) { 1.17 return 0; 1.18 } else { 1.19 @@ -171,12 +174,29 @@ 1.20 } 1.21 } 1.22 1.23 -int cx_cmp_ptr(void const *ptr1, void const *ptr2) { 1.24 - const intptr_t p1 = (const intptr_t) ptr1; 1.25 - const intptr_t p2 = (const intptr_t) ptr2; 1.26 +int cx_cmp_intptr( 1.27 + void const *ptr1, 1.28 + void const *ptr2 1.29 +) { 1.30 + intptr_t p1 = *(const intptr_t *) ptr1; 1.31 + intptr_t p2 = *(const intptr_t *) ptr2; 1.32 if (p1 == p2) { 1.33 return 0; 1.34 } else { 1.35 - return p1 < p2 ? -1 : 1; 1.36 + return p1 < p2 ? -1 : 1; 1.37 } 1.38 } 1.39 + 1.40 +int cx_cmp_uintptr( 1.41 + void const *ptr1, 1.42 + void const *ptr2 1.43 +) { 1.44 + uintptr_t p1 = *(const uintptr_t *) ptr1; 1.45 + uintptr_t p2 = *(const uintptr_t *) ptr2; 1.46 + if (p1 == p2) { 1.47 + return 0; 1.48 + } else { 1.49 + return p1 < p2 ? -1 : 1; 1.50 + } 1.51 +} 1.52 +