]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/ffs.3
All pages: Remove the 5th argument to .TH
[thirdparty/man-pages.git] / man3 / ffs.3
CommitLineData
fea681da
MK
1.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2.\"
5fbde956 3.\" SPDX-License-Identifier: Linux-man-pages-copyleft
fea681da
MK
4.\"
5.\" References consulted:
6.\" Linux libc source code
7.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
8.\" 386BSD man pages
9.\" Modified Sat Jul 24 19:39:35 1993 by Rik Faith (faith@cs.unc.edu)
10.\"
11.\" Modified 2003 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
c13182ef 12.\"
45186a5d 13.TH FFS 3 2021-03-22 "Linux man-pages (unreleased)"
fea681da 14.SH NAME
81927551 15ffs, ffsl, ffsll \- find first bit set in a word
afa8db94
AC
16.SH LIBRARY
17Standard C library
18.RI ( libc ", " \-lc )
fea681da
MK
19.SH SYNOPSIS
20.nf
21.B #include <strings.h>
68e4db0a 22.PP
fea681da 23.BI "int ffs(int " i );
dbfe9c70 24.PP
fea681da 25.B #include <string.h>
68e4db0a 26.PP
ae85f653 27.BI "int ffsl(long " i );
ae85f653 28.BI "int ffsll(long long " i );
fea681da 29.fi
68e4db0a 30.PP
d39ad78f 31.RS -4
be403e3d
MK
32Feature Test Macro Requirements for glibc (see
33.BR feature_test_macros (7)):
d39ad78f 34.RE
68e4db0a 35.PP
be403e3d 36.BR ffs ():
9d2adbae
MK
37.nf
38 Since glibc 2.12:
39 _XOPEN_SOURCE >= 700
5c10d2c5 40 || ! (_POSIX_C_SOURCE >= 200809L)
9d2adbae
MK
41 || /* Glibc since 2.19: */ _DEFAULT_SOURCE
42 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
43 Before glibc 2.12:
44 none
45.fi
be403e3d
MK
46.PP
47.BR ffsl (),
48.BR ffsll ():
9d2adbae
MK
49.nf
50 Since glibc 2.27:
247bbcf0 51.\" glibc commit 68fe16dd327c895c08b9ee443b234c49c13b36e9
9d2adbae
MK
52 _DEFAULT_SOURCE
53 Before glibc 2.27:
54 _GNU_SOURCE
55.fi
fea681da 56.SH DESCRIPTION
60a90ecd
MK
57The
58.BR ffs ()
59function returns the position of the first
fea681da
MK
60(least significant) bit set in the word \fIi\fP.
61The least significant bit is position 1 and the
75b94dc3 62most significant position is, for example, 32 or 64.
60a90ecd
MK
63The functions
64.BR ffsll ()
65and
66.BR ffsl ()
67do the same but take
fea681da 68arguments of possibly different size.
47297adb 69.SH RETURN VALUE
fea681da 70These functions return the position of the first bit set,
fb84c583
MK
71or 0 if no bits are set in
72.IR i .
7eea6fc3 73.SH ATTRIBUTES
067fb97f
MK
74For an explanation of the terms used in this section, see
75.BR attributes (7).
c466875e
MK
76.ad l
77.nh
067fb97f
MK
78.TS
79allbox;
c466875e 80lbx lb lb
067fb97f
MK
81l l l.
82Interface Attribute Value
83T{
7eea6fc3
PH
84.BR ffs (),
85.BR ffsl (),
7eea6fc3 86.BR ffsll ()
067fb97f
MK
87T} Thread safety MT-Safe
88.TE
c466875e
MK
89.hy
90.ad
91.sp 1
3113c7f3 92.SH STANDARDS
a9c6f658 93.BR ffs ():
6d3452a4 94POSIX.1-2001, POSIX.1-2008, 4.3BSD.
847e0d88 95.PP
a385e7d7
MK
96The
97.BR ffsl ()
98and
99.BR ffsll ()
36f9a7fe 100functions are glibc extensions.
fea681da
MK
101.SH NOTES
102BSD systems have a prototype in
103.IR <string.h> .
47297adb 104.SH SEE ALSO
0a4f8b7b 105.BR memchr (3)