MCPcopy Create free account
hub / github.com/F-Stack/f-stack / combining_class

Function combining_class

freebsd/contrib/openzfs/module/unicode/u8_textprep.c:688–726  ·  view source on GitHub ↗

* The combining_class() function checks on the given bytes and find out * the corresponding Unicode combining class value. The return value 0 means * it is a Starter. Any illegal UTF-8 character will also be treated as * a Starter. */

Source from the content-addressed store, hash-verified

686 * a Starter.
687 */
688static uchar_t
689combining_class(size_t uv, uchar_t *s, size_t sz)
690{
691 uint16_t b1 = 0;
692 uint16_t b2 = 0;
693 uint16_t b3 = 0;
694 uint16_t b4 = 0;
695
696 if (sz == 1 || sz > 4)
697 return (0);
698
699 if (sz == 2) {
700 b3 = s[0];
701 b4 = s[1];
702 } else if (sz == 3) {
703 b2 = s[0];
704 b3 = s[1];
705 b4 = s[2];
706 } else if (sz == 4) {
707 b1 = s[0];
708 b2 = s[1];
709 b3 = s[2];
710 b4 = s[3];
711 }
712
713 b1 = u8_common_b1_tbl[uv][b1];
714 if (b1 == U8_TBL_ELEMENT_NOT_DEF)
715 return (0);
716
717 b2 = u8_combining_class_b2_tbl[uv][b1][b2];
718 if (b2 == U8_TBL_ELEMENT_NOT_DEF)
719 return (0);
720
721 b3 = u8_combining_class_b3_tbl[uv][b2][b3];
722 if (b3 == U8_TBL_ELEMENT_NOT_DEF)
723 return (0);
724
725 return (u8_combining_class_b4_tbl[uv][b3][b4]);
726}
727
728/*
729 * The do_decomp() function finds out a matching decomposition if any

Callers 1

collect_a_seqFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected