Commit 05c32952 authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

Unbreak Windows build after UTF-16 change (sys/types.h does not define

int32_t on Windows).
Review URL: https://chromiumcodereview.appspot.com/9669051

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11009 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent da03f56b
......@@ -117,19 +117,19 @@ class Buffer {
class Utf16 {
public:
static inline bool IsLeadSurrogate(int32_t code) {
static inline bool IsLeadSurrogate(int code) {
if (code == kNoPreviousCharacter) return false;
return (code & 0xfc00) == 0xd800;
}
static inline bool IsTrailSurrogate(int32_t code) {
static inline bool IsTrailSurrogate(int code) {
if (code == kNoPreviousCharacter) return false;
return (code & 0xfc00) == 0xdc00;
}
static inline int32_t CombineSurrogatePair(uchar lead, uchar trail) {
static inline int CombineSurrogatePair(uchar lead, uchar trail) {
return 0x10000 + ((lead & 0x3ff) << 10) + (trail & 0x3ff);
}
static const int32_t kNoPreviousCharacter = -1;
static const int kNoPreviousCharacter = -1;
static const uchar kMaxNonSurrogateCharCode = 0xffff;
// Encoding a single UTF-16 code unit will produce 1, 2 or 3 bytes
// of UTF-8 data. The special case where the unit is a surrogate
......@@ -140,10 +140,10 @@ class Utf16 {
// One UTF-16 surrogate is endoded (illegally) as 3 UTF-8 bytes.
// The illegality stems from the surrogate not being part of a pair.
static const int kUtf8BytesToCodeASurrogate = 3;
static inline uchar LeadSurrogate(int32_t char_code) {
static inline uchar LeadSurrogate(int char_code) {
return 0xd800 + (((char_code - 0x10000) >> 10) & 0x3ff);
}
static inline uchar TrailSurrogate(int32_t char_code) {
static inline uchar TrailSurrogate(int char_code) {
return 0xdc00 + (char_code & 0x3ff);
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment