/* This software is licensed by the MIT License, see LICENSE file */ /* Copyright © 2022 Gregory Lirent */ #include "build.h" int char16size(const char16_t* s) { unsigned int v; memcpy(&v, s, 4); if (IS_LITTLE_ENDIAN) { if ((v&0xfc00fc00) == 0xdc00d800) return 2; if ((v&0x0000f800) != 0x0000d800) return 1; } else { if ((v&0xfc00fc00) == 0xd800dc00) return 2; if ((v&0xf8000000) != 0xd8000000) return 1; } return 0; }