Back to index

glibc  2.9
Functions
ffs.c File Reference
#include <string.h>

Go to the source code of this file.

Functions

int __ffs (int x)

Function Documentation

int __ffs ( int  x)

Definition at line 27 of file ffs.c.

{
  int cnt;
  int tmp;

  asm ("bsfl %2,%0\n"              /* Count low bits in X and store in %1.  */
       "cmovel %1,%0\n"            /* If number was zero, use -1 as result.  */
       : "=&r" (cnt), "=r" (tmp) : "rm" (x), "1" (-1));

  return cnt + 1;
}