4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-18 04:19:21 +08:00

33 lines
431 B
C
Raw Normal View History

2000-02-17 19:39:52 +00:00
/*
FUNCTION
<<ffs>>---find first bit set in a word
INDEX
ffs
SYNOPSIS
#include <strings.h>
2000-02-17 19:39:52 +00:00
int ffs(int <[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>
2000-02-17 19:39:52 +00:00
int
ffs(int i)
2000-02-17 19:39:52 +00:00
{
return (__builtin_ffs(i));
2000-02-17 19:39:52 +00:00
}