src/string.cpp
changeset 7928 63e18de69e50
parent 7257 a0c906e11895
child 8113 31b7784db761
equal deleted inserted replaced
7927:3a3289a049f9 7928:63e18de69e50
   212  */
   212  */
   213 size_t Utf8Decode(WChar *c, const char *s)
   213 size_t Utf8Decode(WChar *c, const char *s)
   214 {
   214 {
   215 	assert(c != NULL);
   215 	assert(c != NULL);
   216 
   216 
   217 	if (!HASBIT(s[0], 7)) {
   217 	if (!HasBit(s[0], 7)) {
   218 		/* Single byte character: 0xxxxxxx */
   218 		/* Single byte character: 0xxxxxxx */
   219 		*c = s[0];
   219 		*c = s[0];
   220 		return 1;
   220 		return 1;
   221 	} else if (GB(s[0], 5, 3) == 6) {
   221 	} else if (GB(s[0], 5, 3) == 6) {
   222 		if (IsUtf8Part(s[1])) {
   222 		if (IsUtf8Part(s[1])) {