acompiled

The catalog contains seeded project examples. Your workspace stores your own projects and conversations.

tsvet/utf8-check

Public
Star9

UTF-8 validation in x86-64: a scalar reference and an AVX2 version that checks 32 bytes per step. Every build fuzzes one against the other.

Code
Blame·1 commit across 9 linesoldernewer
2
3UTF-8 validation in x86-64 assembly. For now there is the reference: one byte at a time, with every range of Unicode table 3-7 spelled out.
4
5```c
6int utf8_valid_scalar(const uint8_t *buf, size_t len); // 1 = valid, 0 = not
7```
8
9`test/test.c` checks it against the edges of the table: the first and last code point of every length, both sides of the surrogates, overlongs, and bytes that never appear.