benilla-re systems structs docs

SUniConvertUTF8to16

function · storm · primitive

Address
0x65b350 · 396 bytes, up to 0x65b4db
Signature
int __stdcall (uint16_t *dst, uint32_t cap, const char *src, uint32_t len, uint32_t *written, uint32_t *read)
Meaning
Converts UTF-8 to UTF-16 without validating it, 0xfffd past U+10FFFF; 0 at a NUL, 1 when full
Confidence
verified, proof one
Name from
the community database (idb)
Finding
storm/unicode#converting-utf-8-to-utf-16
Test
storm::utf8_to_utf16_whole

Finding: Converting UTF-8 to UTF-16 in storm: UTF-8 to UTF-16

SUniConvertUTF8to16(dst, cap, src, len, &written, &read) folds a sequence of n + 1 bytes as v = (v << 6) + byte modulo 2^32, less the nth dword of 0x80e764. A v up to 0xffff is one unit, surrogates and overlong forms too, and 0 ends the run with result 0; above 0x10ffff it is 0xfffd; between, the pair 0xd800 + ((v − 0x10000) >> 10), 0xdc00 + (v & 0x3ff). What does not fit in cap returns 1 unstored; a source that runs out returns −1, a sequence past its end −(n + 1). written counts units with the NUL, read bytes without its sequence; a null source or a len of 0 returns −1 and sets neither.

The derivation is in the doc.

Callers 26

Callees 0

None by a direct call or jump.

Calls and jumps by a bare address, from tables/calls.tsv.