OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [libiberty/] [ffs.c] - Blame information for rev 1771

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/* ffs -- Find the first bit set in the parameter
2
 
3
NAME
4
        ffs -- Find the first bit set in the parameter
5
 
6
SYNOPSIS
7
        int ffs (int valu)
8
 
9
DESCRIPTION
10
        Find the first bit set in the parameter. Bits are numbered from
11
        right to left, starting with bit 1.
12
 
13
*/
14
 
15
int
16
ffs (valu)
17
  register int valu;
18
{
19
  register int bit;
20
 
21
  if (valu == 0)
22
    return 0;
23
 
24
  for (bit = 1; !(valu & 1); bit++)
25
        valu >>= 1;
26
 
27
  return bit;
28
}
29
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.