unicode-org / icu4x

Solving i18n for client-side and resource-constrained environments.
https://icu4x.unicode.org
Other
1.38k stars 178 forks source link

Small-only and Fast-only getters for CodePointTrie #5796

Open hsivonen opened 2 weeks ago

hsivonen commented 2 weeks ago

Currently, the getters for CodePointTrie branch multiple times on the trie type.

There should be a set of getters that statically assume the trie type is "small", another set that statically assumes trie type "fast", a public getter for the type, and then the current set of getters should branch on the type once and then delegate to the statically-assuming getters.

See #2431.

hsivonen commented 2 weeks ago

The statically-assuming getters should probably be generic over TrieType so that code that wishes to hoist the branch out of a loop can make the loop generic over TrieType.

sffc commented 1 week ago

Working group discussion: