diff options
| author | Tyge Løvset <[email protected]> | 2022-06-01 09:20:25 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-06-01 09:20:25 +0200 |
| commit | 073854ba3d9dcdc75fff138c489819c30806508e (patch) | |
| tree | 6b95ef688c8d603bd02da3baffa242900b03c682 /include/stc/utf8.h | |
| parent | 22c20b522fcc9cc0743ad04fe6c3203c7a778401 (diff) | |
| download | STC-modified-073854ba3d9dcdc75fff138c489819c30806508e.tar.gz STC-modified-073854ba3d9dcdc75fff138c489819c30806508e.zip | |
Added some docs on utf8. API may change for cstr: to take const cstr* args instead of cstr values.
Diffstat (limited to 'include/stc/utf8.h')
| -rw-r--r-- | include/stc/utf8.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/stc/utf8.h b/include/stc/utf8.h index 630a7a7c..4910900c 100644 --- a/include/stc/utf8.h +++ b/include/stc/utf8.h @@ -41,11 +41,11 @@ int utf8_icmp_n(size_t u8max, const char* s1, size_t n1, const char* s2, size_t n2);
unsigned utf8_encode(char *out, uint32_t c);
-/* encode/decode next utf8 codepoint. */
+/* decode next utf8 codepoint. https://bjoern.hoehrmann.de/utf-8/decoder/dfa */
typedef struct { uint32_t state, codep; } utf8_decode_t;
STC_INLINE uint32_t utf8_decode(utf8_decode_t* d, const uint32_t byte) {
- extern const uint8_t utf8_dtab[];
+ extern const uint8_t utf8_dtab[]; /* utf8code.c */
const uint32_t type = utf8_dtab[byte];
d->codep = d->state ? (byte & 0x3fu) | (d->codep << 6)
: (0xff >> type) & byte;
|
