tochar32_unicode.c 338 B

123456789101112
  1. /* This software is licensed by the MIT License, see LICENSE file */
  2. /* Copyright © 2022 Gregory Lirent */
  3. #include "build.h"
  4. char32_t* tochar32_unicode(char32_t d[1], unsigned int uc) {
  5. if (uc <= 0x10ffff && (uc < 0xd800 || uc > 0xdfff)) {
  6. *(d++) = uc;
  7. } else return 0;
  8. return d;
  9. }