Proposal for Optimized Character Type Function

The Cuthour cuthour@gmail.com
Sat Mar 1 21:49:09 GMT 2025



On 2025/03/02 6:24, enh wrote:
> 
> 
> On Sat, Mar 1, 2025, 15:15 Florian Weimer <fw@deneb.enyo.de 
> <mailto:fw@deneb.enyo.de>> wrote:
> 
>     * The Cuthour:
> 
>      > I am writing to propose an enhancement to the character type
>     functions
>      > such as isalpha(), isupper(), and islower() through the use of
>     optimized
>      > lookup tables. By using a single lookup table with bitwise
>     operations,
>      > we can achieve efficient and concise implementations for these
>      > functions. Below is a brief overview of the proposed implementation:
> 
>     Isn't this basically what the current implementation does, via
>     __ctype_b_loc?  Per-thread state is required to support uselocale.
> 
> 
> yeah, Android's ctype.h is ascii-only, so we can just inline an 
> instruction or two. (whereas wctype.h goes to icu.)
> 

"The table you introduced is a bit hard to decipher, but we could also 
have an array of function pointers with 256 elements, so I think it 
might be a bit simpler."




More information about the Libc-alpha mailing list