summaryrefslogtreecommitdiff
path: root/src/misc/ffs.c
blob: 2f7cb32198462895a67350e87816849c977c4811 (plain) (blame)
1
2
3
4
5
6
7
8
9
#include <strings.h>

int ffs(int i)
{
	unsigned int j = i;
	for (i=1; j && !(j&1); j>>=1, i++);
	if (j) return i;
	return 0;
}