summaryrefslogtreecommitdiff
path: root/LibC/fd_set.h
blob: 802c0b33857e976074c8ce04adc4eb1402bb5246 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#pragma once

#define FD_SETSIZE 64
#define FD_ZERO(set) memset((set), 0, sizeof(fd_set));
#define FD_CLR(fd, set) ((set)->bits[(fd / 8)] &= ~(1 << (fd) % 8))
#define FD_SET(fd, set) ((set)->bits[(fd / 8)] |= (1 << (fd) % 8))
#define FD_ISSET(fd, set) ((set)->bits[(fd / 8)] & (1 << (fd) % 8))

struct __fd_set {
    unsigned char bits[FD_SETSIZE / 8];
};

typedef struct __fd_set fd_set;