Fix tochar16_unicode
This commit is contained in:
parent
974541fd6e
commit
350232189a
@ -3,10 +3,14 @@
|
||||
|
||||
#include "build.h"
|
||||
|
||||
char32_t* tochar32_unicode(char32_t d[1], unsigned int uc) {
|
||||
if (uc <= 0x10ffff && (uc < 0xd800 || uc > 0xdfff)) {
|
||||
char16_t* tochar16_unicode(char16_t d[2], unsigned int uc) {
|
||||
if (uc <= 0xffff) {
|
||||
*(d++) = uc;
|
||||
} else return 0;
|
||||
} else if (uc <= 0x10ffff && (uc < 0xd800 || uc > 0xdfff)) {
|
||||
uc -= 0x010000;
|
||||
*(d++) = 0xd800 | (uc&0x0ffc00)>>10;
|
||||
*(d++) = 0xdc00 | (uc&0x03ff);
|
||||
} else d = 0;
|
||||
|
||||
return d;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user