summaryrefslogtreecommitdiffhomepage
path: root/src/argv
diff options
context:
space:
mode:
Diffstat (limited to 'src/argv')
-rw-r--r--src/argv/ntapi_tt_array_utf16.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/src/argv/ntapi_tt_array_utf16.c b/src/argv/ntapi_tt_array_utf16.c
index fa0892d..2e1bc35 100644
--- a/src/argv/ntapi_tt_array_utf16.c
+++ b/src/argv/ntapi_tt_array_utf16.c
@@ -230,46 +230,47 @@ int32_t __stdcall __ntapi_tt_array_convert_utf16_to_utf8(
/* to: 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx (utf-8) */
/* low two bytes */
- wx = *wch;
- wx <<= 10;
- wx >>= 10;
-
- wy_low = *wch;
- wy_low <<= 6;
- wy_low >>= 12;
-
- /* (surrogate pair) */
- wch++;
-
- /* high two bytes */
- wy_high = *wch;
+ wy_high = *wch;
wy_high <<= 14;
wy_high >>= 10;
- wz = *wch;
+ wz = *wch;
wz <<= 10;
wz >>= 12;
- wz <<= 2;
- ww = *wch;
+ ww = *wch;
ww <<= 6;
ww >>= 12;
- uuuuu = ww + 1;
- u_high = uuuuu >> 2;
- u_low = ((uuuuu << 14) >> 10);
+ /* (surrogate pair) */
+ wch++;
+
+ /* high two bytes */
+ wx = *wch;
+ wx <<= 10;
+ wx >>= 10;
+
+ wy_low = *wch;
+ wy_low <<= 6;
+ wy_low >>= 12;
+
+ /* uuuuu */
+ uuuuu = ww + 1;
+ u_low = uuuuu;
+ u_low >>= 2;
+
+ u_high = uuuuu;
+ u_high <<= 14;
+ u_high >>= 10;
/* 1st byte: 11110uuu */
- *ch = (char)(0xF0 | u_high);
- ch++;
+ *ch++ = (char)(0xF0 | u_low);
/* 2nd byte: 10uuzzzz */
- *ch = (char)(0x80 | u_low | wz);
- ch++;
+ *ch++ = (char)(0x80 | u_high | wz);
/* 3rd byte: 10yyyyyy */
- *ch = (char)(0x80 | wy_low | wy_high);
- ch++;
+ *ch++ = (char)(0x80 | wy_low | wy_high);
/* 4th byte: 10xxxxxx */
*ch = (char)(0x80 | wx);