Hello again almut. I would rather not just compile in the & MASK32 if it is not needed. It is easy enough to set a define in the Makefile.PL if use64bitint is set:
DEFINE => ($Config{use64bitint} ? '-DUSING_64_BIT_INT' : ''),
Then in the C you can use this to provide 2 versions of the MIX macro. I may well be wrong (can't test) but it seems to me that none of the & MASK32 are required in the main jhash code, provided you use a macro setup as shown below. The a b c ints will probably overflow into the low bits of the 64 bit space but because all the operations are addition the low order bits will be the valid representation in 32 bit space. Could you give this a try:
/* Need to constrain U32 to only 32 bits on 64 bit systems
* For efficiency we only use the & 0xffffffff if required
*/
#define USING_64_BIT_INT /* save messing with Makefile.PL define */
#if defined(USING_64_BIT_INT)
#define MIX(a,b,c) \
{ \
a &= 0xffffffff; b &= 0xffffffff; c &= 0xffffffff; \
a -= b; a -= c; a ^= (c>>13); a &= 0xffffffff; \
b -= c; b -= a; b ^= (a<<8); b &= 0xffffffff; \
c -= a; c -= b; c ^= (b>>13); c &= 0xffffffff; \
a -= b; a -= c; a ^= (c>>12); a &= 0xffffffff; \
b -= c; b -= a; b ^= (a<<16); b &= 0xffffffff; \
c -= a; c -= b; c ^= (b>>5); c &= 0xffffffff; \
a -= b; a -= c; a ^= (c>>3); a &= 0xffffffff; \
b -= c; b -= a; b ^= (a<<10); b &= 0xffffffff; \
c -= a; c -= b; c ^= (b>>15); c &= 0xffffffff; \
}
#else
#define MIX(a,b,c) \
{ \
a -= b; a -= c; a ^= (c>>13); \
b -= c; b -= a; b ^= (a<<8); \
c -= a; c -= b; c ^= (b>>13); \
a -= b; a -= c; a ^= (c>>12); \
b -= c; b -= a; b ^= (a<<16); \
c -= a; c -= b; c ^= (b>>5); \
a -= b; a -= c; a ^= (c>>3); \
b -= c; b -= a; b ^= (a<<10); \
c -= a; c -= b; c ^= (b>>15); \
}
#endif
/* rest of code unchanged with no masking */