diff options
Diffstat (limited to 'enc/utf_16le.c')
-rw-r--r-- | enc/utf_16le.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/enc/utf_16le.c b/enc/utf_16le.c index 9547714e52..bec3d22388 100644 --- a/enc/utf_16le.c +++ b/enc/utf_16le.c @@ -102,9 +102,8 @@ utf16le_mbc_to_code(const UChar* p, const UChar* end ARG_UNUSED, UChar c1 = *(p+1); if (UTF16_IS_SURROGATE_FIRST(c1)) { - code = ((((c1 - 0xd8) << 2) + ((c0 & 0xc0) >> 6) + 1) << 16) - + ((((c0 & 0x3f) << 2) + (p[3] - 0xdc)) << 8) - + p[2]; + code = ((((c1 << 8) + c0) & 0x03ff) << 10) + + (((p[3] << 8) + p[2]) & 0x03ff) + 0x10000; } else { code = c1 * 256 + p[0]; |