| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2b702c9 commit aaf04f4
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,6 @@ | |||
| 1 | 1 | #include "node_string.h" | |
| 2 | 2 | #include "node/inspector/protocol/Protocol.h" | |
| 3 | + #include "simdutf.h" | ||
| 3 | 4 | ||
| 4 | 5 | #include <unicode/unistr.h> | |
| 5 | 6 | ||
@@ -118,9 +119,8 @@ const uint8_t* CharactersUTF8(const String& s) { | |||
| 118 | 119 | } | |
| 119 | 120 | ||
| 120 | 121 | size_t CharacterCount(const String& s) { | |
| 121 | - icu::UnicodeString utf16 = | ||
| 122 | - icu::UnicodeString::fromUTF8(icu::StringPiece(s.data(), s.length())); | ||
| 123 | - return utf16.countChar32(); | ||
| 122 | + // TODO(@anonrig): Test to make sure CharacterCount returns correctly. | ||
| 123 | + return simdutf::utf32_length_from_utf8(s.data(), s.length()); | ||
| 124 | 124 | } | |
| 125 | 125 | ||
| 126 | 126 | } // namespace StringUtil | |
| Back | FazBrowse Home | New Git URL |
0 commit comments