UnixLib select and speed
sbellon at sbellon.de
Sat Dec 4 09:32:52 PST 2004
John Tytgat wrote:
> In message <4d18083f23sbellon at sbellon.de>
> Stefan Bellon <sbellon at sbellon.de> wrote:
> > Peter, your latest commit to unix/select.c contains the following
> > line twice:
> > int bits = (nfds % WORD_BITS) ?: WORD_BITS;
> > Is there some GNUish operator ?: or has something gone wrong?
> > Neither I nor Norcroft C don't know this ?: thing.
> Someone is never too old to learn ;-)
> This is semantically the same as :
> int bits = (nfds % WORD_BITS) ? (nfds % WORD_BITS) : WORD_BITS;
That's what I suspected as it's the only way it makes sense. But is
this C90 or C99, or just GNU?
> Incidently, using modula operator on signed int results in less dense
> and optimised code when doing that on an unsigned int. Certainly in
> this case where we can use unsigned int without breaking the code :
More information about the gcc