diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-07-04 13:56:22 +0300 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-07-05 14:49:48 +0300 |
commit | 461152e4ebd94f7d8b1e20f4cd1c704138ba2083 (patch) | |
tree | b7a00b923becba103ee7e05ab92715a0e48baa3d /newlib/libc/misc | |
parent | 2390e71a4278308ba84d937a3fc5a9a10f1f7ecb (diff) |
Add ffsl(), ffsll(), fls(), flsl(), flsll()
Use compiler builtin for ffs(). Remove duplicate implementation from
Cygwin.
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
Diffstat (limited to 'newlib/libc/misc')
-rw-r--r-- | newlib/libc/misc/ffs.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/newlib/libc/misc/ffs.c b/newlib/libc/misc/ffs.c index 7fc38c8d8..ba5700920 100644 --- a/newlib/libc/misc/ffs.c +++ b/newlib/libc/misc/ffs.c @@ -29,18 +29,8 @@ No supporting OS subroutines are required. */ #include <strings.h> int -_DEFUN(ffs, (word), - int word) +ffs(int i) { - int i; - if (!word) - return 0; - - i = 0; - for (;;) - { - if (((1 << i++) & word) != 0) - return i; - } + return (__builtin_ffs(i)); } |