diff --git a/include/common/compat.h b/include/common/compat.h index 4e86325e6..8d406e5c4 100644 --- a/include/common/compat.h +++ b/include/common/compat.h @@ -37,11 +37,9 @@ #include #include -/* INTBITS - * how many bits are needed to code the size of an int on the target platform. - * (eg: 32bits -> 5) - */ -#define INTBITS 5 +#ifndef BITS_PER_INT +#define BITS_PER_INT (8*sizeof(int)) +#endif /* this is for libc5 for example */ #ifndef TCP_NODELAY diff --git a/src/ev_poll.c b/src/ev_poll.c index 5f0a2c49b..4a1eb8bf9 100644 --- a/src/ev_poll.c +++ b/src/ev_poll.c @@ -92,13 +92,13 @@ REGPRM2 static void _do_poll(struct poller *p, int exp) unsigned rn, wn; /* read new, write new */ nbfd = 0; - for (fds = 0; (fds << INTBITS) < maxfd; fds++) { + for (fds = 0; (fds * BITS_PER_INT) < maxfd; fds++) { rn = ((int*)fd_evts[DIR_RD])[fds]; wn = ((int*)fd_evts[DIR_WR])[fds]; if ((rn|wn)) { - for (count = 0, fd = fds << INTBITS; count < (1<> count) & 1; sw = (wn >> count) & 1; #else - sr = FD_ISSET(fd&((1<