Lines Matching refs:wc

61 static const char *utf8_to_wchar(const char *input, wchar_t *wc,  in utf8_to_wchar()  argument
65 *wc = (wchar_t) input[0]; in utf8_to_wchar()
69 *wc = (((wchar_t) input[0] & 0x1f) << 6) | in utf8_to_wchar()
74 *wc = (((wchar_t) input[0] & 0x0f) << 12) | in utf8_to_wchar()
80 *wc = (((wchar_t) input[0] & 0x07) << 18) | in utf8_to_wchar()
87 *wc = (((wchar_t) input[0] & 0x03) << 24) | in utf8_to_wchar()
95 *wc = (((wchar_t) input[0] & 0x01) << 30) | in utf8_to_wchar()
106 static u_int16_t *wchar_to_utf16(u_int16_t *output, wchar_t wc, size_t outsize) in wchar_to_utf16() argument
108 if (wc <= 0xffff) { in wchar_to_utf16()
111 output[0] = cpu_to_le16(wc); in wchar_to_utf16()
116 wc -= 0x10000; in wchar_to_utf16()
117 output[0] = cpu_to_le16(0xd800 | ((wc >> 10) & 0x3ff)); in wchar_to_utf16()
118 output[1] = cpu_to_le16(0xdc00 | (wc & 0x3ff)); in wchar_to_utf16()
127 wchar_t wc; in utf8_to_utf16() local
130 inp = utf8_to_wchar(inp, &wc, insize - (inp - input)); in utf8_to_utf16()
135 outp = wchar_to_utf16(outp, wc, outsize - (outp - output)); in utf8_to_utf16()
145 static const u_int16_t *utf16_to_wchar(const u_int16_t *input, wchar_t *wc, in utf16_to_wchar() argument
151 *wc = ((wchar_t) (le16_to_cpu(input[0]) & 0x3ff) << 10); in utf16_to_wchar()
152 *wc |= (le16_to_cpu(input[1]) & 0x3ff); in utf16_to_wchar()
153 *wc += 0x10000; in utf16_to_wchar()
156 *wc = le16_to_cpu(*input); in utf16_to_wchar()
161 static char *wchar_to_utf8(char *output, wchar_t wc, size_t outsize) in wchar_to_utf8() argument
163 if (wc <= 0x7f) { in wchar_to_utf8()
166 *output++ = (char) wc; in wchar_to_utf8()
167 } else if (wc <= 0x7ff) { in wchar_to_utf8()
170 *output++ = 0xc0 | (wc >> 6); in wchar_to_utf8()
171 *output++ = 0x80 | (wc & 0x3f); in wchar_to_utf8()
172 } else if (wc <= 0xffff) { in wchar_to_utf8()
175 *output++ = 0xe0 | (wc >> 12); in wchar_to_utf8()
176 *output++ = 0x80 | ((wc >> 6) & 0x3f); in wchar_to_utf8()
177 *output++ = 0x80 | (wc & 0x3f); in wchar_to_utf8()
178 } else if (wc <= 0x1fffff) { in wchar_to_utf8()
181 *output++ = 0xf0 | (wc >> 18); in wchar_to_utf8()
182 *output++ = 0x80 | ((wc >> 12) & 0x3f); in wchar_to_utf8()
183 *output++ = 0x80 | ((wc >> 6) & 0x3f); in wchar_to_utf8()
184 *output++ = 0x80 | (wc & 0x3f); in wchar_to_utf8()
185 } else if (wc <= 0x3ffffff) { in wchar_to_utf8()
188 *output++ = 0xf8 | (wc >> 24); in wchar_to_utf8()
189 *output++ = 0x80 | ((wc >> 18) & 0x3f); in wchar_to_utf8()
190 *output++ = 0x80 | ((wc >> 12) & 0x3f); in wchar_to_utf8()
191 *output++ = 0x80 | ((wc >> 6) & 0x3f); in wchar_to_utf8()
192 *output++ = 0x80 | (wc & 0x3f); in wchar_to_utf8()
193 } else if (wc <= 0x7fffffff) { in wchar_to_utf8()
196 *output++ = 0xfc | (wc >> 30); in wchar_to_utf8()
197 *output++ = 0x80 | ((wc >> 24) & 0x3f); in wchar_to_utf8()
198 *output++ = 0x80 | ((wc >> 18) & 0x3f); in wchar_to_utf8()
199 *output++ = 0x80 | ((wc >> 12) & 0x3f); in wchar_to_utf8()
200 *output++ = 0x80 | ((wc >> 6) & 0x3f); in wchar_to_utf8()
201 *output++ = 0x80 | (wc & 0x3f); in wchar_to_utf8()
213 wchar_t wc; in utf16_to_utf8() local
216 inp = utf16_to_wchar(inp, &wc, insize - (inp - input)); in utf16_to_utf8()
221 outp = wchar_to_utf8(outp, wc, outsize - (outp - output)); in utf16_to_utf8()