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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [libiberty/] [ffs.c] - Rev 1774

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

/* ffs -- Find the first bit set in the parameter
 
NAME
	ffs -- Find the first bit set in the parameter
 
SYNOPSIS
	int ffs (int valu)
 
DESCRIPTION
	Find the first bit set in the parameter. Bits are numbered from
	right to left, starting with bit 1.
 
*/
 
int
ffs (valu)
  register int valu;
{
  register int bit;
 
  if (valu == 0)
    return 0;
 
  for (bit = 1; !(valu & 1); bit++)
  	valu >>= 1;
 
  return bit;
}
 
 

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

powered by: WebSVN 2.1.0

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