MCPcopy Index your code
hub / github.com/Exafunction/codeium-chrome / numUtf8BytesForCodePoint

Function numUtf8BytesForCodePoint

src/utf.ts:1–12  ·  view source on GitHub ↗
(codePointValue: number)

Source from the content-addressed store, hash-verified

1function numUtf8BytesForCodePoint(codePointValue: number): number {
2 if (codePointValue < 0x80) {
3 return 1;
4 }
5 if (codePointValue < 0x800) {
6 return 2;
7 }
8 if (codePointValue < 0x10000) {
9 return 3;
10 }
11 return 4;
12}
13
14/**
15 * Calculates for some prefix of the given text, how many bytes the UTF-8

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected