#include "crypto_sort.h" #include "uint16.h" #include "uint32.h" #include "int32.h" /* #include "crypto_int32.h" #define int32 crypto_int32 #include "crypto_uint32.h" #define uint32 crypto_uint32 #include "crypto_uint16.h" #define uint16 crypto_uint16 */ #define sortsmall_LIMIT 65535LL /* assumes 2 <= n <= sortsmall_LIMIT */ static void sortsmall(int32 *x,uint16 n) { int32 y[n]; uint16 i,t0,t1,t2,t3,c0[256],c1[256],c2[256],c3[256]; #include "int32_radix.inc" } #define sortmedium_LIMIT 4294967295LL /* assumes 2 <= n <= sortmedium_LIMIT */ static void sortmedium(int32 *x,uint32 n) { int32 y[n]; uint32 i,t0,t1,t2,t3,c0[256],c1[256],c2[256],c3[256]; #include "int32_radix.inc" } static void sortlarge(int32 *x,long long n) { int32 y[n]; long long i,t0,t1,t2,t3,c0[256],c1[256],c2[256],c3[256]; #include "int32_radix.inc" } void crypto_sort(void *array,long long n) { if (n > sortmedium_LIMIT) sortlarge(array,n); else if (n > sortsmall_LIMIT) sortmedium(array,n); else if (n > 1) //sortsmall(array,n); sortmedium(array,n); }