root/lib/libkern/arch/i386/ffs.S

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. ffs

    1 /*      $OpenBSD: ffs.S,v 1.2 1996/09/27 06:47:45 mickey Exp $  */
    2 
    3 /*
    4  * Written by J.T. Conklin <jtc@netbsd.org>.
    5  * Public domain.
    6  */
    7 
    8 #include <machine/asm.h>
    9 
   10 ENTRY(ffs)
   11         bsfl    4(%esp),%eax
   12         jz      L1                      /* ZF is set if all bits are 0 */
   13         incl    %eax                    /* bits numbered from 1, not 0 */
   14         ret
   15 
   16         .align 2
   17 L1:     xorl    %eax,%eax               /* clear result */
   18         ret

/* [<][>][^][v][top][bottom][index][help] */