diff options
Diffstat (limited to 'prototypes/connections/module-text.c')
| -rw-r--r-- | prototypes/connections/module-text.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/prototypes/connections/module-text.c b/prototypes/connections/module-text.c index 596585c..68c03b0 100644 --- a/prototypes/connections/module-text.c +++ b/prototypes/connections/module-text.c @@ -12,6 +12,11 @@ enum { CHUNK = 4096 }; bool pure_utf8_step(unsigned *state, PureSpan span) { unsigned remaining = *state & 3, range = *state >> 2; for (size_t i = 0; i < span.size; ++i) { + /* Eight ASCII bytes at a time between characters. */ + uint64_t word; + while (!remaining && span.size - i >= 8 && (memcpy(&word, span.data + i, 8), !(word & UINT64_C(0x8080808080808080)))) + i += 8; + if (i == span.size) break; unsigned char b = span.data[i]; if (remaining) { unsigned low = range == 1 ? 0xA0 : range == 3 ? 0x90 : 0x80; |
