Commit Graph

10 Commits

Author SHA1 Message Date
Ryan Libby
ae4a8e5207 bitset: implement BIT_TEST_CLR_ATOMIC & BIT_TEST_SET_ATOMIC
That is, provide wrappers around the atomic_testandclear and
atomic_testandset primitives.

Submitted by:	jeff
Reviewed by:	cem, kib, markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D22702
2020-12-31 13:02:45 -08:00
D Scott Phillips
26a3bf76c9 bitset: expand bit index type to long
An upcoming patch to use the bitset macros for tracking vm page
dump information could conceivably need more than INT_MAX bits.
Expand the bit type to long so that the extra range is available
on 64-bit platforms where it would most likely be needed.

CPUSET_COUNT and DOMAINSET_COUNT are also modified to remain of
type `int`.

Reviewed by:	kib, markj
Approved by:	scottl (implicit)
MFC after:	1 week
Sponsored by:	Ampere Computing, Inc.
Differential Revision:	https://reviews.freebsd.org/D26190
2020-09-21 22:19:12 +00:00
D Scott Phillips
f878200180 bitset: add BIT_FFS_AT() for finding the first bit set greater than a start bit
Reviewed by:	kib
Approved by:	scottl (implicit)
MFC after:	1 week
Sponsored by:	Ampere Computing, Inc.
Differential Revision:	https://reviews.freebsd.org/D26128
2020-08-26 02:07:46 +00:00
Ryan Libby
9825eadf2c bitset: rename confusing macro NAND to ANDNOT
s/BIT_NAND/BIT_ANDNOT/, and for CPU and DOMAINSET too.  The actual
implementation is "and not" (or "but not"), i.e. A but not B.
Fortunately this does appear to be what all existing callers want.

Don't supply a NAND (not (A and B)) operation at this time.

Discussed with:	jeff
Reviewed by:	cem
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D22791
2019-12-13 09:32:16 +00:00
Konstantin Belousov
e967aa2682 Improve BIT_FLS() documentation.
Submitted by:	Sebastian Huber <sebastian.huber@embedded-brains.de>
MFC after:	6 days
2017-07-07 05:43:44 +00:00
Konstantin Belousov
1550c62236 Add BIT_FLS() analogous to BIT_FFS().
The benefit of BIT_FLS() is that ffsl() can be implemented with a
count leading zeros instruction which is more widespread available.

Submitted by:	Sebastian Huber <sebastian.huber@embedded-brains.de>
MFC after:	1 week
2017-07-06 21:47:17 +00:00
Konstantin Belousov
e058e1c43c Add BIT_OR2(), BIT_AND2(), BIT_NAND2(), BIT_XOR() and BIT_XOR2().
Submitted by:	Sebastian Huber <sebastian.huber@embedded-brains.de>
MFC after:	2 weeks
2017-05-24 10:09:54 +00:00
Eric van Gyzen
71aa6fbfe9 Fix two return types in the cpuset(9) and bitset(9) man pages
The *_FFS() and *_COUNT() functions return int, not size_t.

MFC after:	3 days
Sponsored by:	Dell Inc.
2016-07-29 21:12:48 +00:00
Conrad Meyer
5546be25d6 Document cpuset(9)
A follow-up to r289467.

Coerced by:	jhb
Sponsored by:	EMC / Isilon Storage Division
2015-10-20 23:48:14 +00:00
Conrad Meyer
7ebf41220c Document bitset(9) 2015-10-17 19:55:58 +00:00