The need for D-scussion (was Re: D Wishlist)

Karl Heuer karl at haddock.ISC.COM
Tue Mar 15 10:41:30 AEST 1988


In article <3734 at bloom-beacon.MIT.EDU> wesommer at athena.mit.edu (William Sommerfeld) writes:
>On just about any reasonable processor, if you're computing someething
>% or / a power of two, you can turn the operation into an `and' (with
>(2**n)-1) or `shift right' (by n), respectively, which _is_ in hardware

Assuming a two's complement representation and that divide rounds toward zero
(as on a VAX, the usual standard of a "reasonable processor"), your suggested
optimization is not valid if the numerator could be negative.

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