Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ffs.c « misc « libc « newlib - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 068f254812deb62aca7c9dc1c36d9f451142529d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
FUNCTION
	<<ffs>>---find first bit set in a word

INDEX
	ffs

SYNOPSIS
	#include <strings.h>
	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>

int
ffs(int i)
{

	return (__builtin_ffs(i));
}