code: public static int countCodePoints(Slice utf8, int offset, int length)
      {
          checkPositionIndexes(offset, offset + length, utf8.length());
  
          // Quick exit if empty string
          if (length == 0) {
              return 0;
          }
  
          int continuationBytesCount = 0;
          // Length rounded to 8 bytes
          int length8 = length & 0x7FFF_FFF8;
          for (; offset < length8; offset += 8) {
              // Count bytes which are NOT the start of a code point
              continuationBytesCount += countContinuationBytes(utf8.getLongUnchecked(offset));
          }
          // Enough bytes left for 32 bits?
          if (offset + 4 < length) {
              // Count bytes which are NOT the start of a code point
              continuationBytesCount += countContinuationBytes(utf8.getIntUnchecked(offset));
  
              offset += 4;
          }
          // Do the rest one by one
          for (; offset < length; offset++) {
              // Count bytes which are NOT the start of a code point
              continuationBytesCount += countContinuationBytes(utf8.getByteUnchecked(offset));
          }
  
          verify(continuationBytesCount <= length);
          return length - continuationBytesCount;
      }
docs: Counts the code points within UTF-8 encoded slice up to {@code length}.
  <p>
  Note: This method does not explicitly check for valid UTF-8, and may
  return incorrect results or throw an exception for invalid UTF-8.