mirror of
https://github.com/KusakabeShi/EtherGuard-VPN.git
synced 2024-11-25 08:43:08 +01:00
25 lines
469 B
Go
25 lines
469 B
Go
// +build !freebsd
|
|
|
|
/* SPDX-License-Identifier: GPL-2.0
|
|
*
|
|
* Copyright (C) 2017-2018 WireGuard LLC. All Rights Reserved.
|
|
*/
|
|
|
|
package rwcancel
|
|
|
|
import "golang.org/x/sys/unix"
|
|
|
|
type fdSet struct {
|
|
fdset unix.FdSet
|
|
}
|
|
|
|
func (fdset *fdSet) set(i int) {
|
|
bits := 32 << (^uint(0) >> 63)
|
|
fdset.fdset.Bits[i/bits] |= 1 << uint(i%bits)
|
|
}
|
|
|
|
func (fdset *fdSet) check(i int) bool {
|
|
bits := 32 << (^uint(0) >> 63)
|
|
return (fdset.fdset.Bits[i/bits] & (1 << uint(i%bits))) != 0
|
|
}
|