xref: /original-bsd/lib/libc/string/ffs.3 (revision a5a45b47)
1.\" Copyright (c) 1990, 1991 The Regents of the University of California.
2.\" 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	5.3 (Berkeley) 04/19/91
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
23fucntion
24finds the first bit set in
25.Fa value
26and returns the index of that bit.
27Bits are numbered starting from 1, starting at the right-most
28bit.
29A return value of 0 means that the argument was zero.
30.Sh SEE ALSO
31.Xr bitstring 3
32.Sh HISTORY
33The
34.Fn ffs
35function appeared in
36.Bx 4.3 .
37