This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: gold patch committed: Provide own version of ffsll
- From: Dave Korn <dave dot korn dot cygwin at googlemail dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: binutils at sourceware dot org
- Date: Sat, 28 Mar 2009 13:40:59 +0000
- Subject: Re: gold patch committed: Provide own version of ffsll
- References: <m3eiwirziw.fsf@google.com>
Ian Lance Taylor wrote:
> gold uses ffsll, particularly since gcc expands it inline when
> possible. However, some systems don't have ffsll. I committed this
> patch to add a version when the system does not have it. I also tweaked
> the other replacement functions, adding declarations so that they would
> build without warnings.
Did you consider adding these to libiberty instead? I don't know if they're
all appropriate but some of them might well make handy additions, mightn't
they? Also:
+int
+ffsll (long long arg)
+{
+ unsigned long long i;
+ int ret;
+
+ ret = 0;
+ for (i = (unsigned long long) arg; i != 0; i >>= 1)
+ ++ret;
+ return ret;
+}
... does that really find the first set bit? It looks to me like it counts
all the one bits. Possibly the terminating condition was meant to test "(i &
1) != 0"?
cheers,
DaveK