Lines Matching refs:codepoint
16 static bool is_valid_codepoint(int codepoint) in is_valid_codepoint() argument
18 if (codepoint > 0x10FFFFu) { in is_valid_codepoint()
21 if ((codepoint >= 0xFDD0 && codepoint <= 0xFDEF) in is_valid_codepoint()
22 || (codepoint & 0xFFFE) == 0xFFFE) { in is_valid_codepoint()
25 if (codepoint >= 0xD800 && codepoint <= 0xDFFF) { in is_valid_codepoint()
124 ssize_t mod_utf8_encode(char buf[], size_t bufsz, int codepoint) in mod_utf8_encode() argument
128 if (!is_valid_codepoint(codepoint)) { in mod_utf8_encode()
132 if (codepoint > 0 && codepoint <= 0x7F) { in mod_utf8_encode()
133 buf[0] = codepoint & 0x7F; in mod_utf8_encode()
137 if (codepoint <= 0x7FF) { in mod_utf8_encode()
138 buf[0] = 0xC0 | ((codepoint >> 6) & 0x1F); in mod_utf8_encode()
139 buf[1] = 0x80 | (codepoint & 0x3F); in mod_utf8_encode()
143 if (codepoint <= 0xFFFF) { in mod_utf8_encode()
144 buf[0] = 0xE0 | ((codepoint >> 12) & 0x0F); in mod_utf8_encode()
145 buf[1] = 0x80 | ((codepoint >> 6) & 0x3F); in mod_utf8_encode()
146 buf[2] = 0x80 | (codepoint & 0x3F); in mod_utf8_encode()
150 buf[0] = 0xF0 | ((codepoint >> 18) & 0x07); in mod_utf8_encode()
151 buf[1] = 0x80 | ((codepoint >> 12) & 0x3F); in mod_utf8_encode()
152 buf[2] = 0x80 | ((codepoint >> 6) & 0x3F); in mod_utf8_encode()
153 buf[3] = 0x80 | (codepoint & 0x3F); in mod_utf8_encode()