2000-02-18 03:39:52 +08:00
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
<<ffs>>---find first bit set in a word
|
|
|
|
|
|
|
|
INDEX
|
|
|
|
ffs
|
|
|
|
|
2017-11-30 15:39:06 +08:00
|
|
|
SYNOPSIS
|
2011-08-23 20:01:51 +08:00
|
|
|
#include <strings.h>
|
2000-02-18 03:39:52 +08: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. */
|
|
|
|
|
2011-08-23 00:49:37 +08:00
|
|
|
#include <strings.h>
|
2003-06-07 03:57:51 +08:00
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
int
|
2017-07-04 18:56:22 +08:00
|
|
|
ffs(int i)
|
2000-02-18 03:39:52 +08:00
|
|
|
{
|
|
|
|
|
2017-07-04 18:56:22 +08:00
|
|
|
return (__builtin_ffs(i));
|
2000-02-18 03:39:52 +08:00
|
|
|
}
|