'\" te .\" Copyright 1989 AT&T .\" Copyright (c) 1992, X/Open Company Limited All Rights Reserved .\" Portions Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. .\" Oracle gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at http://www.opengroup.org/bookstore/. .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html. This notice shall appear on any product containing this material. .TH ffs 3C "16 Jun 2015" "SunOS 5.11" "Standard C Library Functions" .SH NAME ffs, ffsl, ffsll, fls, flsl, flsll \- find first or last bit set in a bit string .SH SYNOPSIS .LP .nf #include \fBint\fR \fBffs\fR(\fBint\fR \fIvalue\fR); .fi .LP .nf int ffsl(long \fIvalue\fR); .fi .LP .nf int ffsll(long long \fIvalue\fR); .fi .LP .nf int fls(int \fIvalue\fR); .fi .LP .nf int flsl(long \fIvalue\fR); .fi .LP .nf int flsll(long long \fIvalue\fR); .fi .SH DESCRIPTION .sp .LP The \fBffs()\fR, \fBffsl()\fR, and \fBffsll()\fR functions find the first bit set in \fIvalue\fR and return the position of that bit. .sp .LP The \fBfls()\fR, \fBfssl()\fR, and \fBflsll()\fR functions find the last bit set in \fIvalue\fR and return the position of that bit. .sp .LP Bits are numbered starting at one (the least significant bit). .SH RETURN VALUES .sp .LP These functions return the position of the first bit set, or 0 if no bits are set in \fIvalue\fR. .SH ERRORS .sp .LP No errors are defined. .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Interface StabilityCommitted _ MT-LevelMT-Safe _ StandardSee \fBstandards\fR(5). .TE .SH SEE ALSO .sp .LP \fBattributes\fR(5), \fBstandards\fR(5)