libunic/fromchar32_unicode.c

16 lines
409 B
C
Raw Normal View History

2022-05-31 15:28:37 +03:00
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "build.h"
const char32_t* fromchar32_unicode(unsigned int* uc, const char32_t* s) {
unsigned int* p = (void*)s;
if (*p <= 0x10ffff && (*p < 0xd800 || *p > 0xdfff)) {
*uc = *p;
return ++s;
}
return (void*)(size_t)(*uc = 0);
}