diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 08:53:40 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 08:53:40 +0000 |
commit | d6583bb2a13f329cf0332ef2570eb8bb8fc0e39c (patch) | |
tree | ece253b876159b39c620e62b6c9b1174642e070e /lib/libc/arch/i386/string/ffs.S |
initial import of NetBSD tree
Diffstat (limited to 'lib/libc/arch/i386/string/ffs.S')
-rw-r--r-- | lib/libc/arch/i386/string/ffs.S | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/libc/arch/i386/string/ffs.S b/lib/libc/arch/i386/string/ffs.S new file mode 100644 index 00000000000..f4851b81a00 --- /dev/null +++ b/lib/libc/arch/i386/string/ffs.S @@ -0,0 +1,20 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Public domain. + */ + +#include <machine/asm.h> + +#if defined(LIBC_SCCS) + RCSID("$NetBSD: ffs.S,v 1.7 1995/04/28 22:58:00 jtc Exp $") +#endif + +ENTRY(ffs) + bsfl 4(%esp),%eax + jz L1 /* ZF is set if all bits are 0 */ + incl %eax /* bits numbered from 1, not 0 */ + ret + + .align 2 +L1: xorl %eax,%eax /* clear result */ + ret |