'\" te .\" Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. .TH ddi_ffs 9F "16 Jan 2006" "SunOS 5.11" "Kernel Functions for Drivers" .SH NAME ddi_ffs, ddi_fls \- find first (last) bit set in a long integer .SH SYNOPSIS .LP .nf #include #include #include \fBint\fR\fBddi_ffs\fR(\fBlong\fR \fImask\fR); .fi .LP .nf \fBint\fR \fBddi_fls\fR(\fBlong\fR \fImask\fR); .fi .SH INTERFACE LEVEL .sp .LP Solaris DDI specific (Solaris DDI). .SH PARAMETERS .sp .ne 2 .mk .na \fB\fImask\fR\fR .ad .RS 8n .rt A 32-bit argument value to search through. .RE .SH DESCRIPTION .sp .LP The function \fBddi_ffs()\fR takes its argument and returns the shift count that the first (least significant) bit set in the argument corresponds to. The function \fBddi_fls()\fR does the same, only it returns the shift count for the last (most significant) bit set in the argument. .SH RETURN VALUES .sp .ne 2 .mk .na \fB\fB0\fR\fR .ad .RS 5n .rt No bits are set in mask. .RE .sp .ne 2 .mk .na \fB\fIN\fR\fR .ad .RS 5n .rt Bit \fIN\fR is the least significant (\fBddi_ffs\fR) or most significant (\fBddi_fls\fR) bit set in mask. Bits are numbered from \fB1\fR to \fB32\fR, with bit \fB1\fR being the least significant bit position and bit \fB32\fR the most significant position. .RE .SH CONTEXT .sp .LP This function can be called from user, interrupt, or kernel context. .SH SEE ALSO .sp .LP \fIWriting Device Drivers for Oracle Solaris 11.2\fR