From: John Hodge (sonata) Date: Sun, 20 Jan 2013 04:47:23 +0000 (+0800) Subject: Usermode/ld-acess - Fixed error in FD_CLR that nuked the entire block X-Git-Tag: rel0.15~598^2~27 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=4522d9e7f65dd66e242ef5164a0c5e599203f78a;p=tpg%2Facess2.git Usermode/ld-acess - Fixed error in FD_CLR that nuked the entire block --- diff --git a/Usermode/Libraries/ld-acess.so_src/include_exp/acess/fd_set.h b/Usermode/Libraries/ld-acess.so_src/include_exp/acess/fd_set.h index 8972cbe4..b2367d19 100644 --- a/Usermode/Libraries/ld-acess.so_src/include_exp/acess/fd_set.h +++ b/Usermode/Libraries/ld-acess.so_src/include_exp/acess/fd_set.h @@ -30,17 +30,20 @@ static inline void FD_ZERO(fd_set *fdsetp) static inline void FD_CLR(int fd, fd_set *fdsetp) { if(fd < 0 || fd > FD_SETSIZE) return; - fdsetp->flags[fd/16] &= (fd_set_ent_t) ((~1 << (fd%16))) & 0xFFFF; + fd_set_ent_t mask = 1 << (fd % 16); + fdsetp->flags[fd/16] &= ~mask; } static inline void FD_SET(int fd, fd_set *fdsetp) { if(fd < 0 || fd > FD_SETSIZE) return; - fdsetp->flags[fd/16] |= (fd_set_ent_t) (1 << (fd%16)); + fd_set_ent_t mask = 1 << (fd % 16); + fdsetp->flags[fd/16] |= mask; } static inline int FD_ISSET(int fd, fd_set *fdsetp) { if(fd < 0 || fd > FD_SETSIZE) return 0; - return !!( fdsetp->flags[fd/16] & (1<<(fd%16)) ); + fd_set_ent_t mask = 1 << (fd % 16); + return !!( fdsetp->flags[fd/16] & mask ); } #endif