]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Add bit_count to the bitstring(3) api
authorasomers <asomers@FreeBSD.org>
Mon, 23 May 2016 20:29:18 +0000 (20:29 +0000)
committerasomers <asomers@FreeBSD.org>
Mon, 23 May 2016 20:29:18 +0000 (20:29 +0000)
commitd14be2b60f06ebf4ccf3da56f630c33392a87b92
tree75b6884b5df8b2102bd857790de587c4b853854d
parent50b3af23076e765c9e465ecc41463bd28f983697
Add bit_count to the bitstring(3) api

Add a bit_count function, which efficiently counts the number of bits set in
a bitstring.

sys/sys/bitstring.h
tests/sys/sys/bitstring_test.c
share/man/man3/bitstring.3
Add bit_alloc

sys/kern/subr_unit.c
Use bit_count instead of a naive counting loop in check_unrhdr, used
when INVARIANTS are enabled. The userland test runs about 6x faster
in a generic build, or 8.5x faster when built for Nehalem, which has
the POPCNT instruction.

sys/sys/param.h
Bump __FreeBSD_version due to the addition of bit_alloc

UPDATING
Add a note about the ABI incompatibility of the bitstring(3)
changes, as suggested by lidl.

Suggested by: gibbs
Reviewed by: gibbs, ngie
MFC after: 9 days
X-MFC-With: 299090, 300538
Relnotes: yes
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D6255
UPDATING
share/man/man3/bitstring.3
sys/kern/subr_unit.c
sys/sys/bitstring.h
sys/sys/param.h
tests/sys/sys/bitstring_test.c