Messages in this thread | | | From | Andy Shevchenko <> | Date | Mon, 11 Jul 2022 17:03:09 +0200 | Subject | Re: [PATCH 2/2] lib/string.c: Optimize memchr() |
| |
On Mon, Jul 11, 2022 at 5:00 PM Andrey Semashev <andrey.semashev@gmail.com> wrote: > On 7/11/22 17:52, Yu-Jen Chang wrote:
...
> I think you're missing the point. Loads at unaligned addresses may not > be allowed by hardware using conventional load instructions or may be > inefficient. Given that this memchr implementation is used as a fallback > when no hardware-specific version is available, you should be > conservative wrt. hardware capabilities and behavior. You should > probably have a pre-alignment loop.
Exactly! The initial code is broken, NAK.
P.S. At least you may look into strscpy() implementation to get a clue.
-- With Best Regards, Andy Shevchenko
| |