mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-18 12:29:32 +08:00
461152e4eb
Use compiler builtin for ffs(). Remove duplicate implementation from Cygwin. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
37 lines
493 B
C
37 lines
493 B
C
/*
|
|
FUNCTION
|
|
<<ffs>>---find first bit set in a word
|
|
|
|
INDEX
|
|
ffs
|
|
|
|
ANSI_SYNOPSIS
|
|
#include <strings.h>
|
|
int ffs(int <[word]>);
|
|
|
|
TRAD_SYNOPSIS
|
|
#include <strings.h>
|
|
int ffs(<[word]>);
|
|
|
|
DESCRIPTION
|
|
|
|
<<ffs>> returns the first bit set in a word.
|
|
|
|
RETURNS
|
|
<<ffs>> returns 0 if <[c]> is 0, 1 if <[c]> is odd, 2 if <[c]> is a multiple of
|
|
2, etc.
|
|
|
|
PORTABILITY
|
|
<<ffs>> is not ANSI C.
|
|
|
|
No supporting OS subroutines are required. */
|
|
|
|
#include <strings.h>
|
|
|
|
int
|
|
ffs(int i)
|
|
{
|
|
|
|
return (__builtin_ffs(i));
|
|
}
|