This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
Re: [Patch, mips] Faster strcmp for mips
- From: Steve Ellcey <sellcey at mips dot com>
- To: Ondřej Bílka <neleai at seznam dot cz>
- Cc: <libc-ports at sourceware dot org>
- Date: Mon, 18 Nov 2013 15:37:58 -0800
- Subject: Re: [Patch, mips] Faster strcmp for mips
- Authentication-results: sourceware.org; auth=none
- References: <1384464221 dot 2484 dot 86 dot camel at ubuntu-sellcey> <20131114231434 dot GA5331 at domone dot podge> <1384539604 dot 2484 dot 102 dot camel at ubuntu-sellcey> <20131115190200 dot GA28546 at domone dot podge>
On Fri, 2013-11-15 at 20:02 +0100, Ondřej Bílka wrote:
> I decided that using ffls was shorter but for some reasons I kept
> bitfirst there. A correct version is
>
> uint64_t bitmask = DETECTNULL8(x) | (x ^ y);
> int pos = (ffsl(bitmask) - 1) / 8;
> return a[pos] - b[pos];
Yes, that works much better. But it only works in little-endian mode. I
think I would need a fls (find last set) or something similar for
big-endian wouldn't I? Or else I would need to swap the bytes around
before using ffs/ffsl.
Steve Ellcey
sellcey@mips.com