Re: [TRIVIAL] strlen("literal string") -> (sizeof("literal string")-1)

Andi Kleen
2002-08-29T17:49:23Z

On Thu, Aug 29, 2002 at 01:51:00PM -0400, Alexander Viro wrote:
>
>
> On 29 Aug 2002, Andi Kleen wrote:
>
> > It does a better job for near all the string.h stuff. x86-64 just uses
> > the builtins. Only exception is memcpy, where it likes to call out of line
> > memcpy when it is not absolutely sure about all the alignments
> > (especally lots of casting causes that)
>
> memcpy() on x86 includes uses of mmx_memcpy(). Not likely to be done by gcc...
Only for big arguments. That is why it calls the out of line function.
Basically it only inlines when the limit is known and small and the alignments
are known. IMHO the alignment check is overkill for x86, but that is what
it does. That is why I wrapped it a bit (see include/asm-x86_64/string.h)

-Andi