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

Side by Side Diff: src/unicode.h

Issue 11759008: Introduce ENABLE_LATIN_1 compile flag (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix FilterASCII Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/string-search.h ('k') | src/utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // The illegality stems from the surrogate not being part of a pair. 126 // The illegality stems from the surrogate not being part of a pair.
127 static const int kUtf8BytesToCodeASurrogate = 3; 127 static const int kUtf8BytesToCodeASurrogate = 3;
128 static inline uint16_t LeadSurrogate(uint32_t char_code) { 128 static inline uint16_t LeadSurrogate(uint32_t char_code) {
129 return 0xd800 + (((char_code - 0x10000) >> 10) & 0x3ff); 129 return 0xd800 + (((char_code - 0x10000) >> 10) & 0x3ff);
130 } 130 }
131 static inline uint16_t TrailSurrogate(uint32_t char_code) { 131 static inline uint16_t TrailSurrogate(uint32_t char_code) {
132 return 0xdc00 + (char_code & 0x3ff); 132 return 0xdc00 + (char_code & 0x3ff);
133 } 133 }
134 }; 134 };
135 135
136 class Latin1 {
137 public:
138 #ifndef ENABLE_LATIN_1
139 static const unsigned kMaxChar = 0x7f;
140 #else
141 static const unsigned kMaxChar = 0xff;
142 #endif
143 };
136 144
137 class Utf8 { 145 class Utf8 {
138 public: 146 public:
139 static inline uchar Length(uchar chr, int previous); 147 static inline uchar Length(uchar chr, int previous);
140 static inline unsigned Encode( 148 static inline unsigned Encode(
141 char* out, uchar c, int previous); 149 char* out, uchar c, int previous);
142 static uchar CalculateValue(const byte* str, 150 static uchar CalculateValue(const byte* str,
143 unsigned length, 151 unsigned length,
144 unsigned* cursor); 152 unsigned* cursor);
145 static const uchar kBadChar = 0xFFFD; 153 static const uchar kBadChar = 0xFFFD;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 static const int kMaxWidth = 1; 264 static const int kMaxWidth = 1;
257 static int Convert(uchar c, 265 static int Convert(uchar c,
258 uchar n, 266 uchar n,
259 uchar* result, 267 uchar* result,
260 bool* allow_caching_ptr); 268 bool* allow_caching_ptr);
261 }; 269 };
262 270
263 } // namespace unibrow 271 } // namespace unibrow
264 272
265 #endif // V8_UNICODE_H_ 273 #endif // V8_UNICODE_H_
OLDNEW
« no previous file with comments | « src/string-search.h ('k') | src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698