diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-01-23 15:33:56 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-01-23 15:33:56 -0500 |
| commit | f93dde14496ef784df6b7b3e1de1030a868be985 (patch) | |
| tree | e4f5bcc1852d13e2f2d853a1f6590ccdd93e18a2 /stdlib/datatypes.h | |
| parent | c60ea2079fb230213308904cd0966e5481d2d994 (diff) | |
Overhaul of Text implementation to be more like Cords and have much
better performance for long sequences of repeated concatenation.
Diffstat (limited to 'stdlib/datatypes.h')
| -rw-r--r-- | stdlib/datatypes.h | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/stdlib/datatypes.h b/stdlib/datatypes.h index 11ae130e..80591adc 100644 --- a/stdlib/datatypes.h +++ b/stdlib/datatypes.h @@ -66,18 +66,24 @@ typedef struct Range_s { Int_t first, last, step; } Range_t; -enum text_type { TEXT_SHORT_ASCII, TEXT_ASCII, TEXT_SHORT_GRAPHEMES, TEXT_GRAPHEMES, TEXT_SUBTEXT }; +enum text_type { TEXT_ASCII, TEXT_GRAPHEMES, TEXT_CONCAT }; typedef struct Text_s { - int64_t length; // Number of grapheme clusters - uint64_t hash:61; - uint8_t tag:3; + int64_t length:54; // Number of grapheme clusters + uint8_t depth:8; + uint8_t tag:2; union { - char short_ascii[8]; - const char *ascii; - int32_t short_graphemes[2]; - const int32_t *graphemes; - struct Text_s *subtexts; + struct { + const char *ascii; + // char ascii_buf[8]; + }; + struct { + const int32_t *graphemes; + // int32_t grapheme_buf[2]; + }; + struct { + const struct Text_s *left, *right; + }; }; } Text_t; |
