1# Ctype in Picolibc
2
3The Ctype family of functions provide a convenient way to process
4character data. The traditional implementation of these is to build a
5table of per-character classification data and have the individual
6functions index the table and extract the relevant data. This is quite
7efficient in code space and time for each indivdual test, but the
8table introduces a fairly large fixed cost.
9
10Picolibc provides an alternate implementation, selectable when
11compiling files using the API, where each function directly implements
12the necessary comparison operations. These are implemented as inline
13functions. In many cases, the resulting code is no larger than the
14table indexing operations and without the overhead of the table.
15
16When building with the 'optimize for size' option enabled (-Os), the
17new direct implementation is selected by default. You can also force a
18particular mode by defining `_PICOLIBC_CTYPE_SMALL` to `1` (select
19direct implementation) or `0` (select array-based implementation).
20