OSDN Git Service

(split) LDP man-pages の original/ を v3.29 に更新。
[linuxjm/LDP_man-pages.git] / original / man3 / ffs.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" References consulted:
24 .\"     Linux libc source code
25 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
26 .\"     386BSD man pages
27 .\" Modified Sat Jul 24 19:39:35 1993 by Rik Faith (faith@cs.unc.edu)
28 .\"
29 .\" Modified 2003 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
30 .\"
31 .TH FFS 3 2010-09-20 "GNU" "Linux Programmer's Manual"
32 .SH NAME
33 ffs, ffsl, ffsll \- find first bit set in a word
34 .SH SYNOPSIS
35 .nf
36 .B #include <strings.h>
37 .sp
38 .BI "int ffs(int " i );
39 .sp
40 .B #include <string.h>
41 .sp
42 .BI "int ffsl(long int " i );
43 .sp
44 .BI "int ffsll(long long int " i );
45 .fi
46 .sp
47 .in -4n
48 Feature Test Macro Requirements for glibc (see
49 .BR feature_test_macros (7)):
50 .in
51 .PD 0
52 .ad l
53 .sp
54 .BR ffs ():
55 .RS 4
56 .TP 4
57 Since glibc 2.12:
58 _SVID_SOURCE || _BSD_SOURCE ||
59 _POSIX_C_SOURCE\ >=\ 200809L || _XOPEN_SOURCE\ >=\ 700 ||
60 .TP
61 Before glibc 2.12:
62 none
63 .RE
64 .PP
65 .BR ffsl (),
66 .BR ffsll ():
67 .RS 4
68 _GNU_SOURCE
69 .RE
70 .ad
71 .PD
72 .SH DESCRIPTION
73 The
74 .BR ffs ()
75 function returns the position of the first
76 (least significant) bit set in the word \fIi\fP.
77 The least significant bit is position 1 and the
78 most significant position is, for example, 32 or 64.
79 The functions
80 .BR ffsll ()
81 and
82 .BR ffsl ()
83 do the same but take
84 arguments of possibly different size.
85 .SH "RETURN VALUE"
86 These functions return the position of the first bit set,
87 or 0 if no bits are set in
88 .IR i .
89 .SH "CONFORMING TO"
90 .BR ffs ():
91 4.3BSD, POSIX.1-2001.
92
93 The
94 .BR ffsl ()
95 and
96 .BR ffsll ()
97 functions are glibc extensions.
98 .SH NOTES
99 BSD systems have a prototype in
100 .IR <string.h> .
101 .SH "SEE ALSO"
102 .BR memchr (3),
103 .BR feature_test_macros (7)