IsUnsigned() function?

Karl Heuer karl at haddock.ima.isc.com
Wed Jul 25 10:21:12 AEST 1990


In article <15303b1aa0bf26a8c5d4 at canremote.uucp> john.russell at 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 at kelp.ima.isc.com or ima!kelp!karl), The Walking Lint



More information about the Comp.lang.c mailing list