This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, mips] Faster strcmp for mips


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




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