diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-01 05:30:25 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-01 05:30:25 +0000 |
commit | 7e3e79d0833953f8243e304a86a96b7e41a310a6 (patch) | |
tree | 8d1b62223325305b297a0caa6fd6b158e667c0be /enc/utf_16le.c | |
parent | 3a4c2bc034a4205ac7116c69ee39de02defb6d17 (diff) | |
download | ruby-7e3e79d0833953f8243e304a86a96b7e41a310a6.tar.gz |
* enc/utf_16{be,le}.c (utf16{be,le}_mbc_to_code): simplified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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]; |