Use a 3 stage table for Unicode properties

Halves the data size and reduces source code size by 50x
Shows no significant runtime performance effect.
Allows for easily adding more properties to the table in the future
This commit is contained in:
Kovid Goyal
2025-03-25 13:16:59 +05:30
parent b8dc31930a
commit b66a763ddf
5 changed files with 142 additions and 69404 deletions

File diff suppressed because one or more lines are too long

View File

@@ -33,7 +33,7 @@ type GraphemeSegmentationState struct {
}
func CharPropsFor(ch rune) CharProps {
return charprops_t2[(rune(charprops_t1[ch>>charprops_shift])<<charprops_shift)+(ch&charprops_mask)]
return charprops_t3[charprops_t2[(rune(charprops_t1[ch>>charprops_shift])<<charprops_shift)+(ch&charprops_mask)]]
}
func IteratorOverGraphemes(text string) iter.Seq[string] {