1.1 --- a/ucx/comparator.c Wed Feb 27 11:37:27 2013 +0100 1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1.3 @@ -1,54 +0,0 @@ 1.4 -#include "comparator.h" 1.5 -#include "math.h" 1.6 - 1.7 -int ucx_strcmp(void *s1, void *s2, void *data) { 1.8 - return strcmp((char*)s1, (char*)s2); 1.9 -} 1.10 - 1.11 -int ucx_strncmp(void *s1, void *s2, void *n) { 1.12 - return strncmp((char*)s1, (char*)s2, *((size_t*) n)); 1.13 -} 1.14 - 1.15 -int ucx_intcmp(void *i1, void *i2, void *data) { 1.16 - int a = *((int*) i1); 1.17 - int b = *((int*) i2); 1.18 - if (a == b) { 1.19 - return 0; 1.20 - } else { 1.21 - return a < b ? -1 : 1; 1.22 - } 1.23 -} 1.24 - 1.25 -int ucx_floatcmp(void *f1, void *f2, void *epsilon) { 1.26 - float a = *((float*) f1); 1.27 - float b = *((float*) f2); 1.28 - float e = !epsilon ? 1e-6f : *((float*)epsilon); 1.29 - if (fabsf(a - b) < e) { 1.30 - return 0; 1.31 - } else { 1.32 - return a < b ? -1 : 1; 1.33 - } 1.34 -} 1.35 - 1.36 -int ucx_doublecmp(void *d1, void *d2, void *epsilon) { 1.37 - double a = *((float*) d1); 1.38 - double b = *((float*) d2); 1.39 - double e = !epsilon ? 1e-14 : *((double*)epsilon); 1.40 - if (fabs(a - b) < e) { 1.41 - return 0; 1.42 - } else { 1.43 - return a < b ? -1 : 1; 1.44 - } 1.45 -} 1.46 - 1.47 -int ucx_ptrcmp(void *ptr1, void *ptr2, void *data) { 1.48 - if (ptr1 == ptr2) { 1.49 - return 0; 1.50 - } else { 1.51 - return ptr1 < ptr2 ? -1 : 1; 1.52 - } 1.53 -} 1.54 - 1.55 -int ucx_memcmp(void *ptr1, void *ptr2, void *n) { 1.56 - return memcmp(ptr1, ptr2, *((size_t*)n)); 1.57 -}