| 412 | } |
| 413 | |
| 414 | SZ_PUBLIC sz_size_t sz_utf8_count_serial(sz_cptr_t text, sz_size_t length) { |
| 415 | sz_u8_t const *text_u8 = (sz_u8_t const *)text; |
| 416 | sz_u8_t const *end_u8 = text_u8 + length; |
| 417 | sz_size_t char_count = 0; |
| 418 | |
| 419 | while (text_u8 < end_u8) { |
| 420 | // Count this byte if it's NOT a continuation byte |
| 421 | if ((*text_u8 & 0xC0) != 0x80) char_count++; |
| 422 | text_u8++; |
| 423 | } |
| 424 | |
| 425 | return char_count; |
| 426 | } |
| 427 | |
| 428 | SZ_PUBLIC sz_cptr_t sz_utf8_find_nth_serial(sz_cptr_t text, sz_size_t length, sz_size_t n) { |
| 429 | sz_u8_t const *text_u8 = (sz_u8_t const *)text; |
no outgoing calls
no test coverage detected
searching dependent graphs…