diff options
| author | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2026-04-13 00:45:01 +0300 |
|---|---|---|
| committer | Ron Yorston <rmy@pobox.com> | 2026-04-16 10:42:13 +0100 |
| commit | 7c49824cb6137c05583a3ed343975114d12ff0a4 (patch) | |
| tree | 67847cbc59c4a065507d21aa696784f23c60f683 /scripts/embedded_scripts | |
| parent | b5e7ae5e8a8632f03d08a0e000818e49b1e6fb70 (diff) | |
| download | busybox-w32-7c49824cb6137c05583a3ed343975114d12ff0a4.tar.gz busybox-w32-7c49824cb6137c05583a3ed343975114d12ff0a4.tar.bz2 busybox-w32-7c49824cb6137c05583a3ed343975114d12ff0a4.zip | |
win32: actype/isactype: optimize both to O(1)
The premise, and implementation, is simple: instead of doing string
search in a list of strings for the class name - which is fast for the
first strings in the list but slow for the last strings, use perfect
hash to map the string directly to a potential class to match in O(1).
The switch/case in isactype is also changed to a function table in O(1)
(the compiler might have optimized this switch to O(1) jump-table, but
now we don't leave it to chance).
Two implementations are supported: one which allows testing actype_t
value against specific classes like AC_ALNUM etc, and one which doesn't
allow that (just like wctype/iswctype) and is more efficient.
Since nothing uses specific class matches anymore, default is the more
efficient choice - where actype_t is a function pointer to isalnum etc.
And while at it, also change the enum names CCLASS_ALNUM etc to more
appropriate AC_ALNUM etc, to use the AC "namespace".
Diffstat (limited to 'scripts/embedded_scripts')
0 files changed, 0 insertions, 0 deletions
