]>
Commit | Line | Data |
---|---|---|
a1eaacb1 | 1 | '\" t |
fea681da MK |
2 | .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) |
3 | .\" | |
5fbde956 | 4 | .\" SPDX-License-Identifier: Linux-man-pages-copyleft |
fea681da MK |
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 (faith@cs.unc.edu) | |
11 | .\" | |
12 | .\" Modified 2003 Walter Harms (walter.harms@informatik.uni-oldenburg.de) | |
c13182ef | 13 | .\" |
4c1c5274 | 14 | .TH ffs 3 (date) "Linux man-pages (unreleased)" |
fea681da | 15 | .SH NAME |
81927551 | 16 | ffs, ffsl, ffsll \- find first bit set in a word |
afa8db94 AC |
17 | .SH LIBRARY |
18 | Standard C library | |
19 | .RI ( libc ", " \-lc ) | |
fea681da MK |
20 | .SH SYNOPSIS |
21 | .nf | |
22 | .B #include <strings.h> | |
c6d039a3 | 23 | .P |
fea681da | 24 | .BI "int ffs(int " i ); |
ae85f653 | 25 | .BI "int ffsl(long " i ); |
ae85f653 | 26 | .BI "int ffsll(long long " i ); |
fea681da | 27 | .fi |
c6d039a3 | 28 | .P |
d39ad78f | 29 | .RS -4 |
be403e3d MK |
30 | Feature Test Macro Requirements for glibc (see |
31 | .BR feature_test_macros (7)): | |
d39ad78f | 32 | .RE |
c6d039a3 | 33 | .P |
be403e3d | 34 | .BR ffs (): |
9d2adbae MK |
35 | .nf |
36 | Since glibc 2.12: | |
37 | _XOPEN_SOURCE >= 700 | |
5c10d2c5 | 38 | || ! (_POSIX_C_SOURCE >= 200809L) |
75c018a1 AC |
39 | || /* glibc >= 2.19: */ _DEFAULT_SOURCE |
40 | || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE | |
9d2adbae MK |
41 | Before glibc 2.12: |
42 | none | |
43 | .fi | |
c6d039a3 | 44 | .P |
be403e3d MK |
45 | .BR ffsl (), |
46 | .BR ffsll (): | |
9d2adbae MK |
47 | .nf |
48 | Since glibc 2.27: | |
247bbcf0 | 49 | .\" glibc commit 68fe16dd327c895c08b9ee443b234c49c13b36e9 |
9d2adbae MK |
50 | _DEFAULT_SOURCE |
51 | Before glibc 2.27: | |
52 | _GNU_SOURCE | |
53 | .fi | |
fea681da | 54 | .SH DESCRIPTION |
60a90ecd MK |
55 | The |
56 | .BR ffs () | |
57 | function returns the position of the first | |
fea681da MK |
58 | (least significant) bit set in the word \fIi\fP. |
59 | The least significant bit is position 1 and the | |
75b94dc3 | 60 | most significant position is, for example, 32 or 64. |
60a90ecd MK |
61 | The functions |
62 | .BR ffsll () | |
63 | and | |
64 | .BR ffsl () | |
65 | do the same but take | |
fea681da | 66 | arguments of possibly different size. |
47297adb | 67 | .SH RETURN VALUE |
fea681da | 68 | These functions return the position of the first bit set, |
fb84c583 MK |
69 | or 0 if no bits are set in |
70 | .IR i . | |
7eea6fc3 | 71 | .SH ATTRIBUTES |
067fb97f MK |
72 | For an explanation of the terms used in this section, see |
73 | .BR attributes (7). | |
74 | .TS | |
75 | allbox; | |
c466875e | 76 | lbx lb lb |
067fb97f MK |
77 | l l l. |
78 | Interface Attribute Value | |
79 | T{ | |
9e54434e BR |
80 | .na |
81 | .nh | |
7eea6fc3 PH |
82 | .BR ffs (), |
83 | .BR ffsl (), | |
7eea6fc3 | 84 | .BR ffsll () |
067fb97f MK |
85 | T} Thread safety MT-Safe |
86 | .TE | |
3113c7f3 | 87 | .SH STANDARDS |
4131356c AC |
88 | .TP |
89 | .BR ffs () | |
6d3452a4 | 90 | POSIX.1-2001, POSIX.1-2008, 4.3BSD. |
4131356c | 91 | .TP |
a385e7d7 | 92 | .BR ffsl () |
4131356c | 93 | .TQ |
a385e7d7 | 94 | .BR ffsll () |
4131356c | 95 | GNU. |
47297adb | 96 | .SH SEE ALSO |
0a4f8b7b | 97 | .BR memchr (3) |