Path: blob/main/system/lib/llvm-libc/include/llvm-libc-macros/sys-select-macros.h
6173 views
//===-- Macros defined in sys/select.h header file ------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLVM_LIBC_MACROS_SYS_SELECT_MACROS_H9#define LLVM_LIBC_MACROS_SYS_SELECT_MACROS_H1011#define FD_SETSIZE 102412#define __FD_SET_WORD_TYPE unsigned long13#define __FD_SET_WORD_SIZE (sizeof(__FD_SET_WORD_TYPE) * 8)14#define __FD_SET_ARRAYSIZE (FD_SETSIZE / __FD_SET_WORD_SIZE)1516#define FD_ZERO(set) \17do { \18unsigned i; \19for (i = 0; i < __FD_SET_ARRAYSIZE; ++i) \20(set)->__set[i] = 0; \21} while (0)2223#define __FD_WORD(fd) ((fd) / __FD_SET_WORD_SIZE)24#define __FD_MASK(fd) \25((__FD_SET_WORD_TYPE)1) << ((__FD_SET_WORD_TYPE)((fd) % __FD_SET_WORD_SIZE))2627#define FD_CLR(fd, set) (void)((set)->__set[__FD_WORD(fd)] &= ~__FD_MASK(fd))2829#define FD_SET(fd, set) (void)((set)->__set[__FD_WORD(fd)] |= __FD_MASK(fd))3031#define FD_ISSET(fd, set) \32(int)(((set)->__set[__FD_WORD(fd)] & __FD_MASK(fd)) != 0)3334#endif // LLVM_LIBC_MACROS_SYS_SELECT_MACROS_H353637