problem with detzcode on machines w/64 bit longs

Chris Torek torek at BSDI.COM
Fri Mar 10 20:00:53 UTC 1995

>However, not all operating systems have [int32_t] ... Probably a case
>for #ifdef'ing the code.

Hm, good point, I was thinking of BSD systems specifically.  (It is
these `soma' muscle relaxant pills!  I swear! :-) )

If one is to resort to #ifdef's, the original suggestion of testing
the top bit and OR'ing in ~0L << 32 should work, using something like:

	#if LONG_MAX > 2147483647	/* long > 32 bits */
		if (result & (1L << 31))
			result |= ~0L << 32;
		return (result);

The (long)(int32_t) method may produce better code on an Alpha,


More information about the tz mailing list