Debian Codegraph @

upstream/debian-trixie/man3/ffs.3

raw
1 '\" t
2 .\" Copyright 1993 David Metcalfe ([email protected])
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .\" References consulted:
7 .\" Linux libc source code
8 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
9 .\" 386BSD man pages
10 .\" Modified Sat Jul 24 19:39:35 1993 by Rik Faith ([email protected])
11 .\"
12 .\" Modified 2003 Walter Harms ([email protected])
13 .\"
14 .TH ffs 3 2024-05-02 "Linux man-pages 6.9.1"
15 .SH NAME
16 ffs, ffsl, ffsll \- find first bit set in a word
17 .SH LIBRARY
18 Standard C library
19 .RI ( libc ", " \-lc )
20 .SH SYNOPSIS
21 .nf
22 .B #include <strings.h>
23 .P
24 .BI "int ffs(int " i );
25 .BI "int ffsl(long " i );
26 .BI "int ffsll(long long " i );
27 .fi
28 .P
29 .RS -4
30 Feature Test Macro Requirements for glibc (see
31 .BR feature_test_macros (7)):
32 .RE
33 .P
34 .BR ffs ():
35 .nf
36 Since glibc 2.12:
37 _XOPEN_SOURCE >= 700
38 || ! (_POSIX_C_SOURCE >= 200809L)
39 || /* glibc >= 2.19: */ _DEFAULT_SOURCE
40 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
41 Before glibc 2.12:
42 none
43 .fi
44 .P
45 .BR ffsl (),
46 .BR ffsll ():
47 .nf
48 Since glibc 2.27:
49 .\" glibc commit 68fe16dd327c895c08b9ee443b234c49c13b36e9
50 _DEFAULT_SOURCE
51 Before glibc 2.27:
52 _GNU_SOURCE
53 .fi
54 .SH DESCRIPTION
55 The
56 .BR ffs ()
57 function returns the position of the first
58 (least significant) bit set in the word \fIi\fP.
59 The least significant bit is position 1 and the
60 most significant position is, for example, 32 or 64.
61 The functions
62 .BR ffsll ()
63 and
64 .BR ffsl ()
65 do the same but take
66 arguments of possibly different size.
67 .SH RETURN VALUE
68 These functions return the position of the first bit set,
69 or 0 if no bits are set in
70 .IR i .
71 .SH ATTRIBUTES
72 For an explanation of the terms used in this section, see
73 .BR attributes (7).
74 .TS
75 allbox;
76 lbx lb lb
77 l l l.
78 Interface Attribute Value
79 T{
80 .na
81 .nh
82 .BR ffs (),
83 .BR ffsl (),
84 .BR ffsll ()
85 T} Thread safety MT-Safe
86 .TE
87 .SH STANDARDS
88 .TP
89 .BR ffs ()
90 POSIX.1-2001, POSIX.1-2008, 4.3BSD.
91 .TP
92 .BR ffsl ()
93 .TQ
94 .BR ffsll ()
95 GNU.
96 .SH SEE ALSO
97 .BR memchr (3)