summaryrefslogtreecommitdiffstats
path: root/lib/libc/string/ffs.3
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2004-01-13 16:05:47 +0000
committerdes <des@FreeBSD.org>2004-01-13 16:05:47 +0000
commitec1fd605cbbcb4bc5ec851a6775a363b01d56029 (patch)
treeec554f27ccb99efb17cf19602b6279f86f0db08b /lib/libc/string/ffs.3
parentdfa545653779c51e8c959ed4a6ebb441f043566c (diff)
downloadFreeBSD-src-ec1fd605cbbcb4bc5ec851a6775a363b01d56029.zip
FreeBSD-src-ec1fd605cbbcb4bc5ec851a6775a363b01d56029.tar.gz
Add and document ffsl(), fls() and flsl().
Diffstat (limited to 'lib/libc/string/ffs.3')
-rw-r--r--lib/libc/string/ffs.341
1 files changed, 35 insertions, 6 deletions
diff --git a/lib/libc/string/ffs.3 b/lib/libc/string/ffs.3
index 5b5fb6f..cb9c6cc 100644
--- a/lib/libc/string/ffs.3
+++ b/lib/libc/string/ffs.3
@@ -38,23 +38,44 @@
.Dt FFS 3
.Os
.Sh NAME
-.Nm ffs
-.Nd find first bit set in a bit string
+.Nm ffs ,
+.Nm ffsl ,
+.Nm fls ,
+.Nm flsl
+.Nd find first or last bit set in a bit string
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In strings.h
.Ft int
.Fn ffs "int value"
+.Ft int
+.Fn ffsl "long value"
+.Ft int
+.Fn fls "int value"
+.Ft int
+.Fn flsl "long value"
.Sh DESCRIPTION
The
.Fn ffs
-function finds the first bit set in
+and
+.Fn ffsl
+functions find the first bit set in
.Fa value
-and returns the index of that bit.
+and return the index of that bit.
+.Pp
+The
+.Fn fls
+and
+.Fn flsl
+functions find the last bit set in
+.Fa value
+and return the index of that bit.
+.Pp
Bits are numbered starting from 1, starting at the right-most
-bit.
-A return value of 0 means that the argument was zero.
+(least significant) bit.
+A return value of zero from any of these functions means that the
+argument was zero.
.Sh SEE ALSO
.Xr bitstring 3
.Sh HISTORY
@@ -69,3 +90,11 @@ before it was moved to
for
.St -p1003.1-2001
compliance.
+.Pp
+The
+.Fn ffsl ,
+.Fn fls
+and
+.Fn flsl
+functions appeared in
+.Fx 5.3 .
OpenPOWER on IntegriCloud