Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(557)

Unified Diff: runtime/vm/unicode.h

Issue 2081433002: Use official JSON encoding for stream (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fixed & Added UTF-32 characters tests Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/json_test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/unicode.h
diff --git a/runtime/vm/unicode.h b/runtime/vm/unicode.h
index e06f1f933f66ff333744d773456aa7d310a05937..7ea10e970b9c88884624995f1819eaf479a5a4d4 100644
--- a/runtime/vm/unicode.h
+++ b/runtime/vm/unicode.h
@@ -117,17 +117,17 @@ class Utf16 : AllStatic {
}
// Returns true if ch is a lead or trail surrogate.
- static bool IsSurrogate(int32_t ch) {
+ static bool IsSurrogate(uint32_t ch) {
return (ch & 0xFFFFF800) == 0xD800;
}
// Returns true if ch is a lead surrogate.
- static bool IsLeadSurrogate(int32_t ch) {
+ static bool IsLeadSurrogate(uint32_t ch) {
return (ch & 0xFFFFFC00) == 0xD800;
}
// Returns true if ch is a low surrogate.
- static bool IsTrailSurrogate(int32_t ch) {
+ static bool IsTrailSurrogate(uint32_t ch) {
return (ch & 0xFFFFFC00) == 0xDC00;
}
@@ -147,8 +147,8 @@ class Utf16 : AllStatic {
}
// Decodes a surrogate pair into a supplementary code point.
- static int32_t Decode(int32_t lead, int32_t trail) {
- return 0x10000 + ((lead & 0x3FF) << 10) + (trail & 0x3FF);
+ static int32_t Decode(uint16_t lead, uint16_t trail) {
+ return 0x10000 + ((lead & 0x000003FF) << 10) + (trail & 0x3FF);
}
// Encodes a single code point.
« no previous file with comments | « runtime/vm/json_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698