public static int codePointCount(BytesRef utf8) {int pos = utf8.offset;final int limit = pos + utf8.length;final byte[] bytes = utf8.bytes;int codePointCount = 0;for (; pos < limit; codePointCount++) {int v = bytes[pos] & 0xFF;if (v <    0x80) { pos += 1; continue; }if (v >=   0xc0) {if (v <  0xe0) { pos += 2; continue; }if (v <  0xf0) { pos += 3; continue; }if (v <  0xf8) { pos += 4; continue; }}throw new IllegalArgumentException();}if (pos > limit) throw new IllegalArgumentException();return codePointCount;}
public static int CodePointCount(BytesRef utf8){int pos = utf8.Offset;int limit = pos + utf8.Length;var bytes = utf8.Bytes;int codePointCount = 0;for (; pos < limit; codePointCount++){int v = bytes[pos] & 0xFF;if (v <    0x80) { pos += 1; continue; }if (v >=   0xc0){if (v <  0xe0) { pos += 2; continue; }if (v <  0xf0) { pos += 3; continue; }if (v <  0xf8) { pos += 4; continue; }}throw new ArgumentException();}if (pos > limit) throw new ArgumentException();return codePointCount;}