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.

History
9 lines·417 B·Markdown Source Raw Blame

utf8-check

UTF-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.

int utf8_valid_scalar(const uint8_t *buf, size_t len);   // 1 = valid, 0 = not

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.