Return to ffs.S CVS log | Up to [local] / sys / lib / libkern / arch / i386 |
1.1 ! nbrk 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