add FC_IS_CHINESE_UTF8_CHAR

pull/37/head
yuqing 2018-09-17 12:01:03 +08:00
parent 3c9054f215
commit 6ef844bd6b
1 changed files with 6 additions and 0 deletions

View File

@ -217,6 +217,12 @@ typedef void* (*MallocFunc)(size_t size);
#define __gcc_attribute__(x) #define __gcc_attribute__(x)
#endif #endif
#define FC_IS_CHINESE_UTF8_CHAR(p, end) \
((p + 2 < end) && \
((((unsigned char)*p) & 0xF0) == 0xE0) && \
((((unsigned char)*(p + 1)) & 0xC0) == 0x80) && \
((((unsigned char)*(p + 2)) & 0xC0) == 0x80))
//for printf format %.*s //for printf format %.*s
#define FC_PRINTF_STAR_STRING_PARAMS(s) (s).len, (s).str #define FC_PRINTF_STAR_STRING_PARAMS(s) (s).len, (s).str