This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH]: Add ffs to libiberty



Hi. 

I just built 2.11.90 on hppa1.0-hp-mpeix and found that gas was
failing to load because of a lack of ffs() on MPE. Since this
has hit me a few other times in MPE ports, I figured it was time
to add ffs() to libiberty. If this is not the best place for
it, pleaes let me know.

Regards,


M.


---
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/libiberty/ChangeLog,v
retrieving revision 1.87
diff -d -r1.87 ChangeLog
0a1,6
> 2001-07-4  Mark Klein  <mklein@dis.com>
> 
> 	* Makefile.in: Add ffs.c dependency.
> 	* configure.in: Add ffs.c.
> 	* ffs.c: New file.
> 
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/libiberty/Makefile.in,v
retrieving revision 1.22
diff -d -r1.22 Makefile.in
125c125
<         cp-demangle.c dyn-string.c fdmatch.c fnmatch.c getcwd.c		      \
---
>         cp-demangle.c dyn-string.c fdmatch.c fnmatch.c ffs.c getcwd.c	      \
Index: configure
===================================================================
RCS file: /cvs/src/src/libiberty/configure,v
retrieving revision 1.12
diff -d -r1.12 configure
1331a1332
> funcs="$funcs ffs"
1703c1704
<   for ac_func in sysconf times sbrk gettimeofday
---
>   for ac_func in sysconf times sbrk gettimeofday ffs
Index: configure.in
===================================================================
RCS file: /cvs/src/src/libiberty/configure.in,v
retrieving revision 1.12
diff -d -r1.12 configure.in
89a90
> funcs="$funcs ffs"
137c138
<   AC_CHECK_FUNCS(sysconf times sbrk gettimeofday)
---
>   AC_CHECK_FUNCS(sysconf times sbrk gettimeofday ffs)


ffs.c:

/* 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;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]