MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxUnicodeLength

Function fxUnicodeLength

xs/sources/xsCommon.c:1180–1195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1178
1179#if 1
1180txSize fxUnicodeLength(txString theString, txSize* byteLength)
1181{
1182 txU1* p = (txU1*)theString;
1183 txU1 c;
1184 txSize unicodeLength = 0;
1185 txSize utf8Length = 0;
1186
1187 while ((c = c_read8(p++))) {
1188 if ((c & 0xC0) != 0x80)
1189 unicodeLength++;
1190 utf8Length++;
1191 }
1192 if (byteLength)
1193 *byteLength = utf8Length;
1194 return unicodeLength;
1195}
1196#else
1197 // http://www.daemonology.net/blog/2008-06-05-faster-utf8-strlen.html
1198

Callers 15

PiuCodeDictionaryFunction · 0.85
PiuCode_set_stringFunction · 0.85
fxCacheStringInfoFunction · 0.85
fxCacheUnicodeLengthFunction · 0.85
fx_String_prototype_padFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected