benilla-re systems structs docs

Utf8EncodeChar

function · lua · primitive

Address
0x7fbfb0 · 234 bytes, up to 0x7fc099
Meaning
Writes a code point as UTF-8 of up to six bytes and returns the end pointer
Confidence
verified, proof one
Finding
lua/libs#case-mapping

Finding: Case mapping in lua: the libraries

str_lower and str_upper walk a string by UTF-8 code points: Utf8DecodeChar reads one and answers its length, LowerCodepoint or UpperCodepoint maps it, Utf8EncodeChar writes it back. Lowering maps A to Z and 0xc0 to 0xde up by 32, raising maps a to z and 0xe0 to 0xfe down by 32. A byte that is not valid UTF-8 decodes to 0x80000000, which encodes to no bytes, so it is dropped. A NUL byte decodes to -1 and consumes nothing, and the call never returns.

functionnamedecided by
0x7fbdf0str_lowerUtf8DecodeChar (0x7fbe2d), LowerCodepoint (0x7fbe34), Utf8EncodeChar (0x7fbe3e), advance by the length (0x7fbe8a)
0x7fc0c0str_upperthe same loop with UpperCodepoint (0x7fc104)
0x7fbeb0Utf8DecodeCharlead-byte masks 0xfc, 0xf8, 0xf0, 0xe0, 0xc0 (0x7fbef2..0x7fbf4e), continuation test 0xc0 == 0x80 (0x7fbf7c)
0x7fbfb0Utf8EncodeCharlimits 128, 2048, 65536, 2097152, 4194304 and 2147483648 (0x7fbfb6..0x7fc05a)
0x7fc0a0LowerCodepointranges 0x41..0x5a and 0xc0..0xde (0x7fc0a2..0x7fc0b3), plus 32
0x7fc180UpperCodepointranges 0x61..0x7a and 0xe0..0xfe (0x7fc182..0x7fc193), minus 32

The derivation is in the doc.

Callers 2

Callees 0

None by a direct call or jump.

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