return;
}
+const nfdbits = unsafe.Sizeof(_C_long) * 8
+
type FdSet_t struct {
- Fds_bits [(FD_SETSIZE + 63) / 64]int64;
+ Fds_bits [(FD_SETSIZE + nfdbits - 1) / nfdbits]_C_long
}
func FDSet(fd int, set *FdSet_t) {
- set.Fds_bits[fd / 64] |= (1 << (uint)(fd % 64))
+ set.Fds_bits[fd / nfdbits] |= (1 << (uint)(fd % nfdbits))
}
func FDClr(fd int, set *FdSet_t) {
- set.Fds_bits[fd / 64] &= ^(1 << (uint)(fd % 64))
+ set.Fds_bits[fd / nfdbits] &^= (1 << (uint)(fd % nfdbits))
}
func FDIsSet(fd int, set *FdSet_t) bool {
- if set.Fds_bits[fd / 64] & (1 << (uint)(fd % 64)) != 0 {
+ if set.Fds_bits[fd / nfdbits] & (1 << (uint)(fd % nfdbits)) != 0 {
return true
} else {
return false
}
func FDZero(set *FdSet_t) {
- for i := 0; i < ((FD_SETSIZE + 63) / 64); i++ {
+ for i := range set.Fds_bits {
set.Fds_bits[i] = 0
}
}