diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2014-07-11 13:58:36 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2014-07-11 13:58:36 -0400 |
commit | db8934faa1854dafaf4c4ce34d1818e12f67ef52 (patch) | |
tree | ffdf05bc2805316cb865c366165daade0c131d2e | |
parent | efe74214bbb68eaa3d7621e73869b5d58210107e (diff) |
Simplify hb_utf_prev<8> to call hb_utf_next<8>
-rw-r--r-- | src/hb-utf-private.hh | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/src/hb-utf-private.hh b/src/hb-utf-private.hh index 11f23cc9..fece1854 100644 --- a/src/hb-utf-private.hh +++ b/src/hb-utf-private.hh @@ -81,27 +81,11 @@ hb_utf_prev (const uint8_t *text, while (start < text && (*text & 0xc0) == 0x80 && end - text < 4) text--; - hb_codepoint_t c = *text, mask; - unsigned int len; - - /* TODO check for overlong sequences? */ - - HB_UTF8_COMPUTE (c, mask, len); - if (unlikely (!len || (unsigned int) (end - text) != len)) { - *unicode = -1; - return end - 1; - } else { - hb_codepoint_t result; - unsigned int i; - result = c & mask; - for (i = 1; i < len; i++) - { - result <<= 6; - result |= (text[i] & 0x3f); - } - *unicode = result; + if (likely (hb_utf_next (text, end, unicode) == end)) return text; - } + + *unicode = -1; + return end - 1; } |