/* This software is licensed by the MIT License, see LICENSE file */ /* Copyright © 2022 Gregory Lirent */ #include "build.h" char16_t* tochar16_unicode(char16_t d[2], unsigned int uc) { if (uc <= 0xffff) { *(d++) = uc; } else if (uc <= 0x10ffff && (uc < 0xd800 || uc > 0xdfff)) { uc -= 0x010000; *(d++) = 0xd800 | (uc&0x0ffc00)>>10; *(d++) = 0xdc00 | (uc&0x03ff); } else d = 0; return d; }