Name:
Anonymous
2015-02-22 22:53
Hello /prog/, how are you today?
Please post a program written in C, so that we all may compile it on our computers and share in the enjoyment of your program.
Name:
Anonymous
2015-02-23 5:22
#include "void.h"
//4bit radix sort
void u4sort3and(u4* a,u4 size){ int COUNT[16], i;u4* t;
#define radix4a(byte,size,A,TEMP) memset(COUNT,0,16*4);\
for ( i = 0; i < size; ++i)++COUNT[(((A[i]) >> (byte<<2))&0xf)];\
for ( i = 1; i < (16); ++i)COUNT[i] += COUNT[i - 1];\
for ( i = size - 1; i >= 0; --i) {TEMP[COUNT[((A[i] >> (byte<<2)) &0xf)] - 1] = A[i];\
--COUNT[((A[i] >> (byte<<2))&0xf)];}
if(size<1024){u4 t1[size];t=(u4*)&t1;}else{ t=malloc(size*4);};
radix4a(0, size, a,t);radix4a(1, size, t,a);
radix4a(2, size, a,t);radix4a(3, size, t,a);
radix4a(4, size, a,t);radix4a(5, size, t,a);
radix4a(6, size, a,t);radix4a(7, size, t,a);
free(t);}