提交 44ae9be7 编写于 作者: K Konstantin Ritt

Nano optimization to hb_utf16_t and hb_utf32_t ::next()

上级 a6d7668a
......@@ -146,11 +146,11 @@ struct hb_utf16_t
return text;
}
if (likely (hb_in_range (c, 0xD800u, 0xDBFFu)))
if (likely (c <= 0xDBFFu && text < end))
{
/* High-surrogate in c */
hb_codepoint_t l;
if (text < end && ((l = *text), likely (hb_in_range (l, 0xDC00u, 0xDFFFu))))
hb_codepoint_t l = *text;
if (likely (hb_in_range (l, 0xDC00u, 0xDFFFu)))
{
/* Low-surrogate in l */
*unicode = (c << 10) + l - ((0xD800u << 10) - 0x10000u + 0xDC00u);
......@@ -211,13 +211,8 @@ struct hb_utf32_t
hb_codepoint_t *unicode,
hb_codepoint_t replacement)
{
hb_codepoint_t c = *text++;
if (validate && unlikely (c > 0x10FFFFu || hb_in_range (c, 0xD800u, 0xDFFFu)))
goto error;
*unicode = c;
return text;
error:
hb_codepoint_t c = *unicode = *text++;
if (validate && unlikely (c >= 0xD800u && (c <= 0xDFFFu || c > 0x10FFFFu)))
*unicode = replacement;
return text;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册