github.com/tetratelabs/wazero@v1.2.1/internal/platform/fdset.go (about) 1 package platform 2 3 // Set adds the given fd to the set. 4 func (f *FdSet) Set(fd int) { 5 f.Bits[fd/nfdbits] |= (1 << (uintptr(fd) % nfdbits)) 6 } 7 8 // Clear removes the given fd from the set. 9 func (f *FdSet) Clear(fd int) { 10 f.Bits[fd/nfdbits] &^= (1 << (uintptr(fd) % nfdbits)) 11 } 12 13 // IsSet returns true when fd is in the set. 14 func (f *FdSet) IsSet(fd int) bool { 15 return f.Bits[fd/nfdbits]&(1<<(uintptr(fd)%nfdbits)) != 0 16 } 17 18 // Zero clears the set. 19 func (f *FdSet) Zero() { 20 for i := range f.Bits { 21 f.Bits[i] = 0 22 } 23 }