GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: replace icu with simdutf for char counts · nodejs/node@aaf04f4

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/inspector
    • node_string.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/inspector/node_string.cc‎

Copy file name to clipboardExpand all lines: src/inspector/node_string.cc
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "node_string.h"
22
#include "node/inspector/protocol/Protocol.h"
3+
#include "simdutf.h"
34

45
#include <unicode/unistr.h>
56

@@ -118,9 +119,8 @@ const uint8_t* CharactersUTF8(const String& s) {
118119
}
119120

120121
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());
124124
}
125125

126126
} // namespace StringUtil

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.