xref: /freebsd/share/man/man9/bitset.9 (revision 5546be25d6510ece38fa3f537fd2c6891bd5b3d3)
17ebf4122SConrad Meyer.\" Copyright (c) 2015 Conrad Meyer <cem@FreeBSD.org>
27ebf4122SConrad Meyer.\" All rights reserved.
37ebf4122SConrad Meyer.\"
47ebf4122SConrad Meyer.\" Redistribution and use in source and binary forms, with or without
57ebf4122SConrad Meyer.\" modification, are permitted provided that the following conditions
67ebf4122SConrad Meyer.\" are met:
77ebf4122SConrad Meyer.\" 1. Redistributions of source code must retain the above copyright
87ebf4122SConrad Meyer.\"    notice, this list of conditions and the following disclaimer.
97ebf4122SConrad Meyer.\" 2. Redistributions in binary form must reproduce the above copyright
107ebf4122SConrad Meyer.\"    notice, this list of conditions and the following disclaimer in the
117ebf4122SConrad Meyer.\"    documentation and/or other materials provided with the distribution.
127ebf4122SConrad Meyer.\"
137ebf4122SConrad Meyer.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
147ebf4122SConrad Meyer.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
157ebf4122SConrad Meyer.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
167ebf4122SConrad Meyer.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
177ebf4122SConrad Meyer.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
187ebf4122SConrad Meyer.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
197ebf4122SConrad Meyer.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
207ebf4122SConrad Meyer.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
217ebf4122SConrad Meyer.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
227ebf4122SConrad Meyer.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
237ebf4122SConrad Meyer.\" POSSIBILITY OF SUCH DAMAGE.
247ebf4122SConrad Meyer.\"
257ebf4122SConrad Meyer.\" $FreeBSD$
267ebf4122SConrad Meyer.\"
27*5546be25SConrad Meyer.Dd October 20, 2015
287ebf4122SConrad Meyer.Dt BITSET 9
297ebf4122SConrad Meyer.Os
307ebf4122SConrad Meyer.Sh NAME
317ebf4122SConrad Meyer.Nm bitset(9)
327ebf4122SConrad Meyer\(em
337ebf4122SConrad Meyer.Nm BITSET_DEFINE ,
347ebf4122SConrad Meyer.Nm BITSET_T_INITIALIZER ,
357ebf4122SConrad Meyer.Nm BITSET_FSET ,
367ebf4122SConrad Meyer.Nm BIT_CLR ,
377ebf4122SConrad Meyer.Nm BIT_COPY ,
387ebf4122SConrad Meyer.Nm BIT_ISSET ,
397ebf4122SConrad Meyer.Nm BIT_SET ,
407ebf4122SConrad Meyer.Nm BIT_ZERO ,
417ebf4122SConrad Meyer.Nm BIT_FILL ,
427ebf4122SConrad Meyer.Nm BIT_SETOF ,
437ebf4122SConrad Meyer.Nm BIT_EMPTY ,
447ebf4122SConrad Meyer.Nm BIT_ISFULLSET ,
457ebf4122SConrad Meyer.Nm BIT_FFS ,
467ebf4122SConrad Meyer.Nm BIT_COUNT ,
477ebf4122SConrad Meyer.Nm BIT_SUBSET ,
487ebf4122SConrad Meyer.Nm BIT_OVERLAP ,
497ebf4122SConrad Meyer.Nm BIT_CMP ,
507ebf4122SConrad Meyer.Nm BIT_OR ,
517ebf4122SConrad Meyer.Nm BIT_AND ,
527ebf4122SConrad Meyer.Nm BIT_NAND ,
537ebf4122SConrad Meyer.Nm BIT_CLR_ATOMIC ,
547ebf4122SConrad Meyer.Nm BIT_SET_ATOMIC ,
557ebf4122SConrad Meyer.Nm BIT_SET_ATOMIC_ACQ ,
567ebf4122SConrad Meyer.Nm BIT_AND_ATOMIC ,
577ebf4122SConrad Meyer.Nm BIT_OR_ATOMIC ,
587ebf4122SConrad Meyer.Nm BIT_COPY_STORE_REL
597ebf4122SConrad Meyer.Nd bitset manipulation macros
607ebf4122SConrad Meyer.Sh SYNOPSIS
617ebf4122SConrad Meyer.In sys/_bitset.h
627ebf4122SConrad Meyer.In sys/bitset.h
637ebf4122SConrad Meyer.\"
647ebf4122SConrad Meyer.Fn BITSET_DEFINE "STRUCTNAME" "const SETSIZE"
657ebf4122SConrad Meyer.Fn BITSET_T_INITIALIZER "ARRAY_CONTENTS"
667ebf4122SConrad Meyer.Fn BITSET_FSET "N_WORDS"
677ebf4122SConrad Meyer.\"
687ebf4122SConrad Meyer.Fn BIT_CLR "const SETSIZE" "size_t bit" "struct STRUCTNAME *bitset"
697ebf4122SConrad Meyer.Fn BIT_COPY "const SETSIZE" "struct STRUCTNAME *from" "struct STRUCTNAME *to"
707ebf4122SConrad Meyer.Ft bool
717ebf4122SConrad Meyer.Fn BIT_ISSET "const SETSIZE" "size_t bit" "struct STRUCTNAME *bitset"
727ebf4122SConrad Meyer.Fn BIT_SET "const SETSIZE" "size_t bit" "struct STRUCTNAME *bitset"
737ebf4122SConrad Meyer.Fn BIT_ZERO "const SETSIZE" "struct STRUCTNAME *bitset"
747ebf4122SConrad Meyer.Fn BIT_FILL "const SETSIZE" "struct STRUCTNAME *bitset"
757ebf4122SConrad Meyer.Fn BIT_SETOF "const SETSIZE" "size_t bit" "struct STRUCTNAME *bitset"
767ebf4122SConrad Meyer.Ft bool
777ebf4122SConrad Meyer.Fn BIT_EMPTY "const SETSIZE" "struct STRUCTNAME *bitset"
787ebf4122SConrad Meyer.Ft bool
797ebf4122SConrad Meyer.Fn BIT_ISFULLSET "const SETSIZE" "struct STRUCTNAME *bitset"
807ebf4122SConrad Meyer.Ft size_t
817ebf4122SConrad Meyer.Fn BIT_FFS "const SETSIZE" "struct STRUCTNAME *bitset"
827ebf4122SConrad Meyer.Ft size_t
837ebf4122SConrad Meyer.Fn BIT_COUNT "const SETSIZE" "struct STRUCTNAME *bitset"
847ebf4122SConrad Meyer.\"
857ebf4122SConrad Meyer.Ft bool
867ebf4122SConrad Meyer.Fo BIT_SUBSET
877ebf4122SConrad Meyer.Fa "const SETSIZE" "struct STRUCTNAME *haystack" "struct STRUCTNAME *needle"
887ebf4122SConrad Meyer.Fc
897ebf4122SConrad Meyer.Ft bool
907ebf4122SConrad Meyer.Fo BIT_OVERLAP
917ebf4122SConrad Meyer.Fa "const SETSIZE" "struct STRUCTNAME *bitset1" "struct STRUCTNAME *bitset2"
927ebf4122SConrad Meyer.Fc
937ebf4122SConrad Meyer.Ft bool
947ebf4122SConrad Meyer.Fo BIT_CMP
957ebf4122SConrad Meyer.Fa "const SETSIZE" "struct STRUCTNAME *bitset1" "struct STRUCTNAME *bitset2"
967ebf4122SConrad Meyer.Fc
977ebf4122SConrad Meyer.Fn BIT_OR "const SETSIZE" "struct STRUCTNAME *dst" "struct STRUCTNAME *src"
987ebf4122SConrad Meyer.Fn BIT_AND "const SETSIZE" "struct STRUCTNAME *dst" "struct STRUCTNAME *src"
997ebf4122SConrad Meyer.Fn BIT_NAND "const SETSIZE" "struct STRUCTNAME *dst" "struct STRUCTNAME *src"
1007ebf4122SConrad Meyer.\"
1017ebf4122SConrad Meyer.Fn BIT_CLR_ATOMIC "const SETSIZE" "size_t bit" "struct STRUCTNAME *bitset"
1027ebf4122SConrad Meyer.Fn BIT_SET_ATOMIC "const SETSIZE" "size_t bit" "struct STRUCTNAME *bitset"
1037ebf4122SConrad Meyer.Fn BIT_SET_ATOMIC_ACQ "const SETSIZE" "size_t bit" "struct STRUCTNAME *bitset"
1047ebf4122SConrad Meyer.\"
1057ebf4122SConrad Meyer.Fo BIT_AND_ATOMIC
1067ebf4122SConrad Meyer.Fa "const SETSIZE" "struct STRUCTNAME *dst" "struct STRUCTNAME *src"
1077ebf4122SConrad Meyer.Fc
1087ebf4122SConrad Meyer.Fo BIT_OR_ATOMIC
1097ebf4122SConrad Meyer.Fa "const SETSIZE" "struct STRUCTNAME *dst" "struct STRUCTNAME *src"
1107ebf4122SConrad Meyer.Fc
1117ebf4122SConrad Meyer.Fo BIT_COPY_STORE_REL
1127ebf4122SConrad Meyer.Fa "const SETSIZE" "struct STRUCTNAME *from" "struct STRUCTNAME *to"
1137ebf4122SConrad Meyer.Fc
1147ebf4122SConrad Meyer.Sh DESCRIPTION
1157ebf4122SConrad MeyerThe
1167ebf4122SConrad Meyer.Nm
1177ebf4122SConrad Meyerfamily of macros provide a flexible and efficient bitset implementation if the
1187ebf4122SConrad Meyermaximum size of the set is known at compilation.
1197ebf4122SConrad MeyerThroughout this manual page, the name
1207ebf4122SConrad Meyer.Fa SETSIZE
1217ebf4122SConrad Meyerrefers to the size of the bitset in bits.
1227ebf4122SConrad MeyerIndividual bits in bitsets are referenced with indices zero through
1237ebf4122SConrad Meyer.Fa SETSIZE - 1 .
1247ebf4122SConrad MeyerOne example use of
1257ebf4122SConrad Meyer.In sys/bitset.h
1267ebf4122SConrad Meyeris
1277ebf4122SConrad Meyer.In sys/cpuset.h .
1287ebf4122SConrad Meyer.Pp
1297ebf4122SConrad MeyerThe
1307ebf4122SConrad Meyer.Fn BITSET_DEFINE
1317ebf4122SConrad Meyermacro defines a bitset struct
1327ebf4122SConrad Meyer.Fa STRUCTNAME
1337ebf4122SConrad Meyerwith room to represent
1347ebf4122SConrad Meyer.Fa SETSIZE
1357ebf4122SConrad Meyerbits.
1367ebf4122SConrad Meyer.Pp
1377ebf4122SConrad MeyerThe
1387ebf4122SConrad Meyer.Fn BITSET_T_INITIALIZER
1397ebf4122SConrad Meyermacro allows one to initialize a bitset struct with a compile time literal
1407ebf4122SConrad Meyervalue.
1417ebf4122SConrad Meyer.Pp
1427ebf4122SConrad MeyerThe
1437ebf4122SConrad Meyer.Fn BITSET_FSET
1447ebf4122SConrad Meyermacro generates a compile time literal, usable by
1457ebf4122SConrad Meyer.Fn BITSET_T_INITIALIZER ,
1467ebf4122SConrad Meyerrepresenting a full bitset (all bits set).
1477ebf4122SConrad MeyerFor examples of
1487ebf4122SConrad Meyer.Fn BITSET_T_INITIALIZER
1497ebf4122SConrad Meyerand
1507ebf4122SConrad Meyer.Fn BITSET_FSET
1517ebf4122SConrad Meyerusage, see the
1527ebf4122SConrad Meyer.Sx BITSET_T_INITIALIZER EXAMPLE
1537ebf4122SConrad Meyersection.
1547ebf4122SConrad MeyerThe
1557ebf4122SConrad Meyer.Fa N_WORDS
1567ebf4122SConrad Meyerparameter to
1577ebf4122SConrad Meyer.Fn BITSET_FSET
1587ebf4122SConrad Meyershould be:
1597ebf4122SConrad Meyer.Bd -literal -offset indent
1607ebf4122SConrad Meyer__bitset_words(SETSIZE)
1617ebf4122SConrad Meyer.Ed
1627ebf4122SConrad Meyer.Pp
1637ebf4122SConrad MeyerThe
1647ebf4122SConrad Meyer.Fn BIT_CLR
1657ebf4122SConrad Meyermacro clears bit
1667ebf4122SConrad Meyer.Fa bit
1677ebf4122SConrad Meyerin the bitset pointed to by
1687ebf4122SConrad Meyer.Fa bitset .
1697ebf4122SConrad MeyerThe
1707ebf4122SConrad Meyer.Fn BIT_CLR_ATOMIC
1717ebf4122SConrad Meyermacro is identical, but the bit is cleared atomically.
1727ebf4122SConrad Meyer.Pp
1737ebf4122SConrad MeyerThe
1747ebf4122SConrad Meyer.Fn BIT_COPY
1757ebf4122SConrad Meyermacro copies the contents of the bitset
1767ebf4122SConrad Meyer.Fa from
1777ebf4122SConrad Meyerto the bitset
1787ebf4122SConrad Meyer.Fa to .
1797ebf4122SConrad Meyer.Fn BIT_COPY_STORE_REL
1807ebf4122SConrad Meyeris similar, but copies component machine words from
1817ebf4122SConrad Meyer.Fa from
1827ebf4122SConrad Meyerand writes them to
1837ebf4122SConrad Meyer.Fa to
1847ebf4122SConrad Meyerwith atomic store with release semantics.
1857ebf4122SConrad Meyer(That is, if
1867ebf4122SConrad Meyer.Fa to
1877ebf4122SConrad Meyeris composed of multiple machine words,
1887ebf4122SConrad Meyer.Fn BIT_COPY_STORE_REL
1897ebf4122SConrad Meyerperforms multiple individually atomic operations.)
1907ebf4122SConrad Meyer.Pp
1917ebf4122SConrad MeyerThe
1927ebf4122SConrad Meyer.Fn BIT_SET
1937ebf4122SConrad Meyermacro sets bit
1947ebf4122SConrad Meyer.Fa bit
1957ebf4122SConrad Meyerin the bitset pointed to by
1967ebf4122SConrad Meyer.Fa bitset .
1977ebf4122SConrad MeyerThe
1987ebf4122SConrad Meyer.Fn BIT_SET_ATOMIC
1997ebf4122SConrad Meyermacro is identical, but the bit is set atomically.
2007ebf4122SConrad MeyerThe
2017ebf4122SConrad Meyer.Fn BIT_SET_ATOMIC_ACQ
2027ebf4122SConrad Meyermacro sets the bit with acquire semantics.
2037ebf4122SConrad Meyer.Pp
2047ebf4122SConrad MeyerThe
2057ebf4122SConrad Meyer.Fn BIT_ZERO
2067ebf4122SConrad Meyermacro clears all bits in
2077ebf4122SConrad Meyer.Fa bitset .
2087ebf4122SConrad Meyer.Pp
2097ebf4122SConrad MeyerThe
2107ebf4122SConrad Meyer.Fn BIT_FILL
2117ebf4122SConrad Meyermacro sets all bits in
2127ebf4122SConrad Meyer.Fa bitset .
2137ebf4122SConrad Meyer.Pp
2147ebf4122SConrad MeyerThe
2157ebf4122SConrad Meyer.Fn BIT_SETOF
2167ebf4122SConrad Meyermacro clears all bits in
2177ebf4122SConrad Meyer.Fa bitset
2187ebf4122SConrad Meyerbefore setting only bit
2197ebf4122SConrad Meyer.Fa bit .
2207ebf4122SConrad Meyer.Pp
2217ebf4122SConrad MeyerThe
2227ebf4122SConrad Meyer.Fn BIT_EMPTY
2237ebf4122SConrad Meyermacro returns
2247ebf4122SConrad Meyer.Dv true
2257ebf4122SConrad Meyerif
2267ebf4122SConrad Meyer.Fa bitset
2277ebf4122SConrad Meyeris empty.
2287ebf4122SConrad Meyer.Pp
2297ebf4122SConrad MeyerThe
2307ebf4122SConrad Meyer.Fn BIT_ISFULLSET
2317ebf4122SConrad Meyermacro returns
2327ebf4122SConrad Meyer.Dv true
2337ebf4122SConrad Meyerif
2347ebf4122SConrad Meyer.Fa bitset
2357ebf4122SConrad Meyeris full (all bits set).
2367ebf4122SConrad Meyer.Pp
2377ebf4122SConrad MeyerThe
2387ebf4122SConrad Meyer.Fn BIT_FFS
2397ebf4122SConrad Meyermacro returns the 1-index of the first (lowest) set bit in
2407ebf4122SConrad Meyer.Fa bitset ,
2417ebf4122SConrad Meyeror zero if
2427ebf4122SConrad Meyer.Fa bitset
2437ebf4122SConrad Meyeris empty.
2447ebf4122SConrad MeyerLike with
2457ebf4122SConrad Meyer.Xr ffs 3 ,
2467ebf4122SConrad Meyerto use the non-zero result of
2477ebf4122SConrad Meyer.Fn BIT_FFS
2487ebf4122SConrad Meyeras a
2497ebf4122SConrad Meyer.Fa bit
2507ebf4122SConrad Meyerindex parameter to any other
2517ebf4122SConrad Meyer.Nm
2527ebf4122SConrad Meyermacro, you must subtract one from the result.
2537ebf4122SConrad Meyer.Pp
2547ebf4122SConrad MeyerThe
2557ebf4122SConrad Meyer.Fn BIT_COUNT
2567ebf4122SConrad Meyermacro returns the total number of set bits in
2577ebf4122SConrad Meyer.Fa bitset .
2587ebf4122SConrad Meyer.Pp
2597ebf4122SConrad MeyerThe
2607ebf4122SConrad Meyer.Fn BIT_SUBSET
2617ebf4122SConrad Meyermacro returns
2627ebf4122SConrad Meyer.Dv true
2637ebf4122SConrad Meyerif
2647ebf4122SConrad Meyer.Fa needle
2657ebf4122SConrad Meyeris a subset of
2667ebf4122SConrad Meyer.Fa haystack .
2677ebf4122SConrad Meyer.Pp
2687ebf4122SConrad MeyerThe
2697ebf4122SConrad Meyer.Fn BIT_OVERLAP
2707ebf4122SConrad Meyermacro returns
2717ebf4122SConrad Meyer.Dv true
2727ebf4122SConrad Meyerif
2737ebf4122SConrad Meyer.Fa bitset1
2747ebf4122SConrad Meyerand
2757ebf4122SConrad Meyer.Fa bitset2
2767ebf4122SConrad Meyerhave any common bits.
2777ebf4122SConrad Meyer(That is, if
2787ebf4122SConrad Meyer.Fa bitset1
2797ebf4122SConrad MeyerAND
2807ebf4122SConrad Meyer.Fa bitset2
2817ebf4122SConrad Meyeris not the empty set.)
2827ebf4122SConrad Meyer.Pp
2837ebf4122SConrad MeyerThe
2847ebf4122SConrad Meyer.Fn BIT_CMP
2857ebf4122SConrad Meyermacro returns
2867ebf4122SConrad Meyer.Dv true
2877ebf4122SConrad Meyerif
2887ebf4122SConrad Meyer.Fa bitset1
2897ebf4122SConrad Meyeris NOT equal to
2907ebf4122SConrad Meyer.Fa bitset2 .
2917ebf4122SConrad Meyer.Pp
2927ebf4122SConrad MeyerThe
2937ebf4122SConrad Meyer.Fn BIT_OR
2947ebf4122SConrad Meyermacro sets bits present in
2957ebf4122SConrad Meyer.Fa src
2967ebf4122SConrad Meyerin
2977ebf4122SConrad Meyer.Fa dst .
2987ebf4122SConrad Meyer(It is the
2997ebf4122SConrad Meyer.Nm
3007ebf4122SConrad Meyerequivalent of the scalar:
3017ebf4122SConrad Meyer.Fa dst
3027ebf4122SConrad Meyer|=
3037ebf4122SConrad Meyer.Fa src . )
3047ebf4122SConrad Meyer.Fn BIT_OR_ATOMIC
3057ebf4122SConrad Meyeris similar, but sets bits in the component machine words in
3067ebf4122SConrad Meyer.Fa dst
3077ebf4122SConrad Meyeratomically.
3087ebf4122SConrad Meyer(That is, if
3097ebf4122SConrad Meyer.Fa dst
3107ebf4122SConrad Meyeris composed of multiple machine words,
3117ebf4122SConrad Meyer.Fn BIT_OR_ATOMIC
3127ebf4122SConrad Meyerperforms multiple individually atomic operations.)
3137ebf4122SConrad Meyer.Pp
3147ebf4122SConrad MeyerThe
3157ebf4122SConrad Meyer.Fn BIT_AND
3167ebf4122SConrad Meyermacro clears bits absent from
3177ebf4122SConrad Meyer.Fa src
3187ebf4122SConrad Meyerfrom
3197ebf4122SConrad Meyer.Fa dst .
3207ebf4122SConrad Meyer(It is the
3217ebf4122SConrad Meyer.Nm
3227ebf4122SConrad Meyerequivalent of the scalar:
3237ebf4122SConrad Meyer.Fa dst
3247ebf4122SConrad Meyer&=
3257ebf4122SConrad Meyer.Fa src . )
3267ebf4122SConrad Meyer.Fn BIT_AND_ATOMIC
3277ebf4122SConrad Meyeris similar, with the same atomic semantics as
3287ebf4122SConrad Meyer.Fn BIT_OR_ATOMIC .
3297ebf4122SConrad Meyer.Pp
3307ebf4122SConrad MeyerThe
3317ebf4122SConrad Meyer.Fn BIT_NAND
3327ebf4122SConrad Meyermacro clears bits set in
3337ebf4122SConrad Meyer.Fa src
3347ebf4122SConrad Meyerfrom
3357ebf4122SConrad Meyer.Fa dst .
3367ebf4122SConrad Meyer(It is the
3377ebf4122SConrad Meyer.Nm
3387ebf4122SConrad Meyerequivalent of the scalar:
3397ebf4122SConrad Meyer.Fa dst
3407ebf4122SConrad Meyer&=
3417ebf4122SConrad Meyer.Fa ~ src . )
3427ebf4122SConrad Meyer.Sh BITSET_T_INITIALIZER EXAMPLE
3437ebf4122SConrad Meyer.Bd -literal
3447ebf4122SConrad MeyerBITSET_DEFINE(_myset, MYSETSIZE);
3457ebf4122SConrad Meyer
3467ebf4122SConrad Meyerstruct _myset myset;
3477ebf4122SConrad Meyer
3487ebf4122SConrad Meyer/* Initialize myset to filled (all bits set) */
3497ebf4122SConrad Meyermyset = BITSET_T_INITIALIZER(BITSET_FSET(__bitset_words(MYSETSIZE)));
3507ebf4122SConrad Meyer
3517ebf4122SConrad Meyer/* Initialize myset to only the lowest bit set */
3527ebf4122SConrad Meyermyset = BITSET_T_INITIALIZER(0x1);
3537ebf4122SConrad Meyer.Ed
3547ebf4122SConrad Meyer.Sh SEE ALSO
355*5546be25SConrad Meyer.Xr bitstring 3 ,
356*5546be25SConrad Meyer.Xr cpuset 9
3577ebf4122SConrad Meyer.Sh HISTORY
3587ebf4122SConrad MeyerThe
3597ebf4122SConrad Meyer.Nm
3607ebf4122SConrad Meyermacros first appeared in
3617ebf4122SConrad Meyer.Fx 10.0
3627ebf4122SConrad Meyerin January 2014.
3637ebf4122SConrad MeyerThey were MFCed to
3647ebf4122SConrad Meyer.Fx 9.3 ,
3657ebf4122SConrad Meyerreleased in July 2014.
3667ebf4122SConrad Meyer.Pp
3677ebf4122SConrad MeyerThis manual page first appeared in
3687ebf4122SConrad Meyer.Fx 11.0 .
3697ebf4122SConrad Meyer.Sh AUTHORS
3707ebf4122SConrad Meyer.An -nosplit
3717ebf4122SConrad MeyerThe
3727ebf4122SConrad Meyer.Nm
373*5546be25SConrad Meyermacros were generalized and pulled out of
3747ebf4122SConrad Meyer.In sys/cpuset.h
375*5546be25SConrad Meyeras
3767ebf4122SConrad Meyer.In sys/_bitset.h
3777ebf4122SConrad Meyerand
3787ebf4122SConrad Meyer.In sys/bitset.h
3797ebf4122SConrad Meyerby
3807ebf4122SConrad Meyer.An Attilio Rao Aq Mt attilio@FreeBSD.org .
3817ebf4122SConrad MeyerThis manual page was written by
3827ebf4122SConrad Meyer.An Conrad Meyer Aq Mt cem@FreeBSD.org .
3837ebf4122SConrad Meyer.Sh CAVEATS
3847ebf4122SConrad MeyerThe
3857ebf4122SConrad Meyer.Fa SETSIZE
3867ebf4122SConrad Meyerargument to all of these macros must match the value given to
3877ebf4122SConrad Meyer.Fn BITSET_DEFINE .
3887ebf4122SConrad Meyer.Pp
3897ebf4122SConrad MeyerUnlike every other reference to individual set members, which are zero-indexed,
3907ebf4122SConrad Meyer.Fn BIT_FFS
3917ebf4122SConrad Meyerreturns a one-indexed result (or zero if the set is empty).
392