problem with detzcode on machines w/64 bit longs

Chris G Demetriou Chris_G_Demetriou at LAGAVULIN.PDL.CS.CMU.EDU
Fri Mar 10 15:13:29 UTC 1995


> How about this?
> 
> 	result = 0;
> 	for (i = 0; i < 4; ++i)
> 		result = (result << 8) | (codep[i] & 0xff);
> 	return((result >> 31) ? (result | (~0L << 32)) : result);

yeah, that should work as desired, though i forget if "0L" is an
ansi-C-ism, and don't have a book around to check...

you definitely _do_ need the cast to long, in some form, otherwise
it'll lose.


cgd



More information about the tz mailing list