new copyright; att/bsd/shared
[unix-history] / usr / src / lib / libc / string / ffs.c
CommitLineData
86fec01b
KB
1/*-
2 * Copyright (c) 1990 The Regents of the University of California.
3c38b559
KB
3 * All rights reserved.
4 *
86fec01b 5 * %sccs.include.redist.c%
dba1d438
KM
6 */
7
8#if defined(LIBC_SCCS) && !defined(lint)
336401ac 9static char sccsid[] = "@(#)ffs.c 5.4 (Berkeley) %G%";
3c38b559 10#endif /* LIBC_SCCS and not lint */
dba1d438 11
336401ac
KB
12#include <string.h>
13
dba1d438
KM
14/*
15 * ffs -- vax ffs instruction
16 */
17ffs(mask)
86fec01b 18 register int mask;
dba1d438 19{
86fec01b 20 register int bit;
dba1d438
KM
21
22 if (mask == 0)
23 return(0);
86fec01b 24 for (bit = 1; !(mask & 1); bit++)
dba1d438 25 mask >>= 1;
86fec01b 26 return(bit);
dba1d438 27}