gcc -O2 produces exactly the same code for this on little-endian
systems, but now big-endian systems have a chance of passing ‘make
check’.
Change-Id: Ifc6350648355a0a9f79184439e3f9522cd6f2ffa
Reviewed-on: https://gerrit.openafs.org/12493
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
{
const unsigned char *str = (const unsigned char *) val;
afs_uint32 a,b,c;
- afs_uint32 k[3];
/* Set up the internal state */
a = b = c = 0xdeadbeef + (((afs_uint32)length)<<2) + initval;
while (length > 12) {
- memcpy(&k, str, 12);
- a += k[0];
- b += k[1];
- c += k[2];
+ a += (afs_uint32) str[3]<<24 |
+ (afs_uint32) str[2]<<16 |
+ (afs_uint32) str[1]<<8 |
+ (afs_uint32) str[0];
+ b += (afs_uint32) str[7]<<24 |
+ (afs_uint32) str[6]<<16 |
+ (afs_uint32) str[5]<<8 |
+ (afs_uint32) str[4];
+ c += (afs_uint32) str[11]<<24 |
+ (afs_uint32) str[10]<<16 |
+ (afs_uint32) str[9]<<8 |
+ (afs_uint32) str[8];
opr_jhash_mix(a, b, c);
length -= 12;
str += 12;