Hi everyone, I'm facing the same problem than Eduardo (http://stackoverflow.com/questions/539311/generate-a-hash-sum-for-several-integers) but mine is a little bit different as said in the title.
I have four 32bits integers and I need to generate a 64bits unique key. What I have done for now is to generate a string concatenation of the fours integers separated by a '/' and then, generate a CRC with the string.
char id_s[64];
sprintf(id_s, "%d/%d/%d/%d", a, b, c, d);
uint64_t id = CRC(id_s);
But the problem is that I have to do it several million times so it appears to be very CPU consuming. So I was thinking about directly storing the four integers into a single integer.
This can be done easily if the four integers where 16bits integers. It could just be done using bit shift operator.
uint64_t id = a << 48 + b << 32 + c << 16 + d;
With four 32bits integers, I have to put 128bits into a single 64bits integer.
Does someone have any suggestion?