xref: /original-bsd/lib/libc/string/ffs.3 (revision 7afc0fa3)
1.\" Copyright (c) 1990, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Chris Torek.
6.\" %sccs.include.redist.man%
7.\"
8.\"     @(#)ffs.3	8.2 (Berkeley) 04/19/94
9.\"
10.Dd
11.Dt FFS 3
12.Os
13.Sh NAME
14.Nm ffs
15.Nd find first bit set in a bit string
16.Sh SYNOPSIS
17.Fd #include <string.h>
18.Ft int
19.Fn ffs "int value"
20.Sh DESCRIPTION
21The
22.Fn ffs
23function finds the first bit set in
24.Fa value
25and returns the index of that bit.
26Bits are numbered starting from 1, starting at the right-most
27bit.
28A return value of 0 means that the argument was zero.
29.Sh SEE ALSO
30.Xr bitstring 3
31.Sh HISTORY
32The
33.Fn ffs
34function appeared in
35.Bx 4.3 .
36