Drop main() prototype. Syncs with NetBSD-8
[minix.git] / common / lib / libc / arch / x86_64 / string / ffs.S
blob00d4437c1c8b56848622c29f0a3cc08cfd88fa0f
1 /*
2  * Written by J.T. Conklin <jtc@NetBSD.org>.
3  * Public domain.
4  * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com>
5  */
7 #include <machine/asm.h>
9 #if defined(LIBC_SCCS)
10         RCSID("$NetBSD: ffs.S,v 1.5 2014/03/22 19:16:34 jakllsch Exp $")
11 #endif
13 ENTRY(ffs)
14         bsfl    %edi,%eax
15         jz      1f                      /* ZF is set if all bits are 0 */
16         incl    %eax                    /* bits numbered from 1, not 0 */
17         ret
19 1:      xorl    %eax,%eax               /* clear result */
20         ret
21 END(ffs)