nightly: remove unused BINARCHIVE
[unleashed.git] / share / man / man3c / ffs.3c
blob99bd577c63efa569b8127f7b2041878da7ad5514
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright 1989 AT&T
44 .\" Portions Copyright (c) 1992, X/Open Company Limited  All Rights Reserved
45 .\" Copyright (c) 2002, Sun Microsystems, Inc.  All Rights Reserved.
46 .\" Copyright 2016 Joyent, Inc.
47 .\"
48 .TH FFS 3C "May 21, 2015"
49 .SH NAME
50 ffs, ffsl, ffsll, fls, flsl, flsll \- find first set bit
51 .SH SYNOPSIS
52 .LP
53 .nf
54 #include <strings.h>
56 \fBint\fR \fBffs\fR(\fBint\fR \fIi\fR);
58 \fBint\fR \fBffsl\fR(\fBlong\fR \fIi\fR);
60 \fBint\fR \fBffsll\fR(\fBlong long\fR \fIi\fR);
62 \fBint\fR \fBfls\fR(\fBint\fR \fIi\fR);
64 \fBint\fR \fBflsl\fR(\fBlong\fR \fIi\fR);
66 \fBint\fR \fBflsll\fR(\fBlong long\fR \fIi\fR);
67 .fi
69 .SH DESCRIPTION
70 .LP
71 The \fBffs()\fR, \fBffsl()\fR, and \fBffsll()\fR functions finds the first bit set
72 (beginning with the least significant bit) and return the index of that bit.
73 Bits are numbered starting at one (the least significant bit).
74 .sp
75 .LP
76 The \fBfls()\fR, \fBflsl()\fR, and \fBflsll()\fR functions find the last bit set
77 (beginning with the least significant bit) and return the index of that bit.
78 Bits are numbered starting at one (the least significant bit).
79 .SH RETURN VALUES
80 .LP
81 The \fBffs()\fR, \fBffsl()\fR, and \fBffsll()\fR functions returns the index of
82 the first bit set.  If \fIi\fR is 0, then they return 0.
83 .sp
84 .LP
85 The \fBfls()\fR, \fBflsl()\fR, and \fBflsll()\fR functions return the index of
86 the last bit set.  If \fIi\fR is 0, then they return 0.
87 .SH ERRORS
88 .LP
89 No errors are defined.
90 .SH ATTRIBUTES
91 .LP
92 See \fBattributes\fR(5) for descriptions of the following attributes:
93 .sp
95 .sp
96 .TS
97 box;
98 c | c
99 l | l .
100 ATTRIBUTE TYPE  ATTRIBUTE VALUE
102 Interface Stability     Committed
104 MT-Level        MT-Safe
107 .SH SEE ALSO
109 \fBattributes\fR(5), \fBstandards\fR(5)