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 () | |
tree | 8d1b62223325305b297a0caa6fd6b158e667c0be | |
parent | 3a4c2bc034a4205ac7116c69ee39de02defb6d17 (diff) |
* 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
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | enc/utf_16be.c | 5 | ||||
-rw-r--r-- | enc/utf_16le.c | 5 |
3 files changed, 8 insertions, 6 deletions
@@ -1,3 +1,7 @@ Thu Apr 1 14:07:51 2010 NARUSE, Yui <[email protected]> * util.c (BSD__hdtoa): don't use C99 macros. (FP_NORMAL etc) @@ -108,9 +108,8 @@ utf16be_mbc_to_code(const UChar* p, const UChar* end ARG_UNUSED, OnigCodePoint code; if (UTF16_IS_SURROGATE_FIRST(*p)) { - code = ((((p[0] - 0xd8) << 2) + ((p[1] & 0xc0) >> 6) + 1) << 16) - + ((((p[1] & 0x3f) << 2) + (p[2] - 0xdc)) << 8) - + p[3]; } else { code = p[0] * 256 + p[1]; @@ -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]; } else { code = c1 * 256 + p[0]; |