*** UNIX MANUAL PAGE BROWSER ***

A Nergahak database for man pages research.

Navigation

Directory Browser

1Browse 4.4BSD4.4BSD
1Browse Digital UNIXDigital UNIX 4.0e
1Browse FreeBSDFreeBSD 14.3
1Browse MINIXMINIX 3.4.0rc6-d5e4fc0
1Browse NetBSDNetBSD 10.1
1Browse OpenBSDOpenBSD 7.7
1Browse UNIX v7Version 7 UNIX
1Browse UNIX v10Version 10 UNIX

Manual Page Search

Manual Page Result

0 Command: __BITMAP_ISSET | Section: 3 | Source: NetBSD | File: __BITMAP_ISSET.3
BITMAP(3) FreeBSD Library Functions Manual BITMAP(3) NAME __BITMAP_CLR, __BITMAP_ISSET, __BITMAP_SET, __BITMAP_SIZE, __BITMAP_TYPE, __BITMAP_ZERO - bitmap manipulation macros LIBRARY Standard C Library (libc, -lc) SYNOPSIS #include <sys/bitops.h> __BITMAP_CLR(int bit, type *bitmap); __BITMAP_ISSET(int bit, type *bitmap); __BITMAP_SET(int bit, type *bitmap); __BITMAP_SIZE(type, int nbits); __BITMAP_TYPE(name, type, int nbits); __BITMAP_ZERO(type *bitmap); DESCRIPTION The supplied macros are similar to the select(2) FD_SET() family, to the setbit(9), macros and the bitstring(3) library. They are different from FD_SET() because they are designed to handle multiple sized bitmaps at the same time, and they can be of any integral type. They are different from setbit(9) because they can operate on different integral types, not just on bytes. They are different from bitstring(3) because they are just macros, they don't allocate memory or use code, and they can be used in both kernel and userland. The following macros are provided for manipulating creating and manipulating bitmaps: __BITMAP_CLR(bit, bitmap) removes the given bit from the bitmap. __BITMAP_ISSET(bit, bitmap) is non-zero if bit is a member of bitmap, zero otherwise. __BITMAP_SET(bit, bitmap) Sets the given bit in the bitmap. __BITMAP_SIZE(type, nbits) Returns the number of elements would be required of the given type to hold nbits. __BITMAP_TYPE(name, type, nbits) Declares the properly sized bitmap structure of the given type that holds nbits and is named name. __BITMAP_ZERO(bitmap) initializes a descriptor set pointed to by bitmap to the null set. The behavior of these macros is undefined for negative bit values or ones greater than the number of bits the bitmap can hold. EXAMPLES #include <sys/bitops.h> int main(int argc, char **argv) { __BITMAP_TYPE(, uint32_t, 5000) bitmap; /* Initialize the read set to null */ __BITMAP_ZERO(&bitmap); /* Set bit 1 */ __BITMAP_SET(1, &bitmap); for (size_t i = 0; i < 5000; i++) { if (__BITMAP_ISSET(i, &bitmap)) { /* Should just print 1 */ printf("Bit %zu is set\n", i); __BITMAP_CLR(i, &bitmap); } break; } return 0; } SEE ALSO select(2), bitops(3), bitstring(3), setbit(9) HISTORY The __BITMAP_*() macros appeared in NetBSD 7.0. FreeBSD 14.1-RELEASE-p8 March 8, 2018 FreeBSD 14.1-RELEASE-p8

Navigation Options