[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] unistr/u8-strchr: speed up searching for ASCII characters
From: |
Ralf Wildenhues |
Subject: |
Re: [PATCH] unistr/u8-strchr: speed up searching for ASCII characters |
Date: |
Thu, 8 Jul 2010 05:24:31 +0200 |
User-agent: |
Mutt/1.5.20 (2010-04-22) |
Hi Pádraig,
* Pádraig Brady wrote on Wed, Jul 07, 2010 at 03:44:29PM CEST:
> Subject: [PATCH] unistr/u8-strchr: speed up searching for ASCII characters
> --- a/lib/unistr/u8-strchr.c
> +++ b/lib/unistr/u8-strchr.c
> uint8_t *
> u8_strchr (const uint8_t *s, ucs4_t uc)
> {
> uint8_t c[6];
>
> if (uc < 0x80)
> - {
> - uint8_t c0 = uc;
> -
> - for (;; s++)
> - {
> - if (*s == c0)
> - break;
> - if (*s == 0)
> - goto notfound;
> - }
> - return (uint8_t *) s;
> - }
> + return strchr (s, uc);
Don't you still have to cast the result to uint8_t *? char may be
signed, leading at least to warnings with -Wall.
Cheers,
Ralf