Path: utzoo!mnetor!uunet!husc6!necntc!ima!haddock!karl From: karl@haddock.ISC.COM (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: The need for D-scussion (was Re: D Wishlist) Message-ID: <2958@haddock.ISC.COM> Date: 15 Mar 88 00:41:30 GMT References: <12176@brl-adm.ARPA> <1988Mar11.215238.976@utzoo.uucp> <3732@bloom-beacon.MIT.EDU> <3734@bloom-beacon.MIT.EDU> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 10 In article <3734@bloom-beacon.MIT.EDU> wesommer@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@haddock.isc.com), The Walking Lint