C optimizer

Karl Heuer karl at haddock.ima.isc.com
Thu Feb 16 11:45:58 AEST 1989


In article <3684 at arcturus> evil at arcturus.UUCP (Wade Guthrie) writes:
>I would expect the following optimizations: ... 3) reducing things like
>intval/2 == intval >> 1 when they are faster.

On most implementations these are not equivalent, unless the compiler can
prove that intval >= 0.

(Ah, many's the time I've wished I could declare a type `nonnegative', which
would be the intersection of signed and unsigned, so the compiler could use
whichever happened to be faster...)

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list