From 55a89eef51d5a91be65f136631688b2c5b3371ab Mon Sep 17 00:00:00 2001 From: kib Date: Thu, 13 Jul 2017 08:29:01 +0000 Subject: MFC r320755,r320762,r320893: BIT_FLS(9). --- share/man/man9/bitset.9 | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'share') diff --git a/share/man/man9/bitset.9 b/share/man/man9/bitset.9 index d4060ac..1d02eee 100644 --- a/share/man/man9/bitset.9 +++ b/share/man/man9/bitset.9 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 24, 2017 +.Dd July 7, 2017 .Dt BITSET 9 .Os .Sh NAME @@ -43,6 +43,7 @@ .Nm BIT_EMPTY , .Nm BIT_ISFULLSET , .Nm BIT_FFS , +.Nm BIT_FLS , .Nm BIT_COUNT , .Nm BIT_SUBSET , .Nm BIT_OVERLAP , @@ -85,6 +86,8 @@ .Ft int .Fn BIT_FFS "const SETSIZE" "struct STRUCTNAME *bitset" .Ft int +.Fn BIT_FLS "const SETSIZE" "struct STRUCTNAME *bitset" +.Ft int .Fn BIT_COUNT "const SETSIZE" "struct STRUCTNAME *bitset" .\" .Ft bool @@ -282,6 +285,23 @@ index parameter to any other macro, you must subtract one from the result. .Pp The +.Fn BIT_FLS +macro returns the 1-index of the last (highest) set bit in +.Fa bitset , +or zero if +.Fa bitset +is empty. +Like with +.Xr fls 3 , +to use the non-zero result of +.Fn BIT_FLS +as a +.Fa bit +index parameter to any other +.Nm +macro, you must subtract one from the result. +.Pp +The .Fn BIT_COUNT macro returns the total number of set bits in .Fa bitset . @@ -499,4 +519,6 @@ argument to all of these macros must match the value given to .Pp Unlike every other reference to individual set members, which are zero-indexed, .Fn BIT_FFS -returns a one-indexed result (or zero if the set is empty). +and +.Fn BIT_FLS +return a one-indexed result (or zero if the set is empty). -- cgit v1.1