Re: [PATCH v2 3/6] match_basename: use strncmp instead of strcmp
- From
Antoine Pelisse <apelisse@gmail.com>
- Date
- Mar 10, 2013, 11:43 UTC
- Message-ID
- <CALWbr2wEJy0p2hcFK_rLtA98koeacE8rS2T=9P130GUFjWKc0Q@mail.gmail.com>
- In-Reply-To
- <CACsJy8A_4SqLu5L6P0PJ78Lwy12fjL7T2p-KbVEVLJmKNqhyRw@mail.gmail.com>
On Sun, Mar 10, 2013 at 11:38 AM, Duy Nguyen <pclouds@gmail.com> wrote:
> glibc's C strncmp version does 4-byte comparison at a time when n >=4, > then fall back to 1-byte for the rest.
Looking at this (http://fossies.org/dox/glibc-2.17/strncmp_8c_source.html), it's not exactly true.
It would rather be while (n >= 4), manually unroll the loop.