Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!decwrl!bacchus.pa.dec.com!deccrl!decvax.dec.com!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: IsUnsigned() function? Message-ID: <17146@haddock.ima.isc.com> Date: 25 Jul 90 00:21:12 GMT References: <15303b1aa0bf26a8c5d4@canremote.uucp> Reply-To: karl@kelp.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 12 In article <15303b1aa0bf26a8c5d4@canremote.uucp> john.russell@canremote.uucp (JOHN RUSSELL) writes: >[What if the idea was to avoid a branch?] If the macro is being used in a Boolean context, then you've got a branch anyway, and simply writing `x >= 0' is optimal. If it's being used in an arithmetic context, *and* if `f = (x >= 0)' generates an inefficient branch that can be avoided by rewriting it in terms of bit-twiddling, *and* if this difference is critical, then the company should be hiring somebody to fix the compiler rather than the source code. And the interviewee should not be expected to deduce all this from the question as asked! Karl W. Z. Heuer (karl@kelp.ima.isc.com or ima!kelp!karl), The Walking Lint