return 1;
} else {
// Supplementary plane character
- *out = 0xD800 | (*in & 0x3FF);
+ *out = 0xD800 | (*in >> 10);
if(bufsize >= 2) {
- out[1] = 0xDC00 | (*in >> 10);
+ out[1] = 0xDC00 | (*in & 0x3FF);
return 2;
} else {
- ps->_Surrogate = 0xDC00 | (*in >> 10);
+ ps->_Surrogate = 0xDC00 | (*in & 0x3FF);
return 1;
}
}
* encountered), else return false.
*/
+ /* mbsinit. Mandatory. */
+ _PDCLIB_bool (*__mbsinit)(const _PDCLIB_mbstate_t *_P_ps);
+
/* UCS-4 variants. Mandatory. */
_PDCLIB_bool (*__mbstoc32s)(
#if _PDCLIB_WCHAR_ENCODING == _PDCLIB_WCHAR_ENCODING_UTF16
#define _PDCLIB_mbrtocwc_l mbrtoc16_l
+ #define _PDCLIB_mbrtocwc mbrtoc16
#define _PDCLIB_cwcrtomb_l c16rtomb_l
+ #define _PDCLIB_cwcrtomb c16rtomb
#elif _PDCLIB_WCHAR_ENCODING == _PDCLIB_WCHAR_ENCODING_UCS4
#define _PDCLIB_mbrtocwc_l mbrtoc32_l
+ #define _PDCLIB_mbrtocwc mbrtoc32
#define _PDCLIB_cwcrtomb_l c32rtomb_l
+ #define _PDCLIB_cwcrtomb c32rtomb
#else
#error _PDCLIB_WCHAR_ENCODING not defined correctly
#error Define to one of _PDCLIB_WCHAR_ENCODING_UCS4 or _PDCLIB_WCHAR_ENCODING_UTF16