File tree 1 file changed +2
-8
lines changed
1 file changed +2
-8
lines changed Original file line number Diff line number Diff line change @@ -91,12 +91,6 @@ static bool EncodeToUTF8(unsigned CharValue,
91
91
return false ;
92
92
}
93
93
94
-
95
- // / CLO8 - Return the number of leading ones in the specified 8-bit value.
96
- static unsigned CLO8 (unsigned char C) {
97
- return llvm::countl_one (uint32_t (C) << 24 );
98
- }
99
-
100
94
// / isStartOfUTF8Character - Return true if this isn't a UTF8 continuation
101
95
// / character, which will be of the form 0b10XXXXXX
102
96
static bool isStartOfUTF8Character (unsigned char C) {
@@ -129,14 +123,14 @@ uint32_t swift::validateUTF8CharacterAndAdvance(const char *&Ptr,
129
123
130
124
// Read the number of high bits set, which indicates the number of bytes in
131
125
// the character.
132
- unsigned EncodedBytes = CLO8 (CurByte);
126
+ unsigned char EncodedBytes = llvm::countl_one (CurByte);
133
127
assert ((EncodedBytes >= 2 && EncodedBytes <= 4 ));
134
128
135
129
// Drop the high bits indicating the # bytes of the result.
136
130
unsigned CharValue = (unsigned char )(CurByte << EncodedBytes) >> EncodedBytes;
137
131
138
132
// Read and validate the continuation bytes.
139
- for (unsigned i = 1 ; i != EncodedBytes; ++i) {
133
+ for (unsigned char i = 1 ; i != EncodedBytes; ++i) {
140
134
if (Ptr >= End)
141
135
return ~0U ;
142
136
CurByte = *Ptr ;
You can’t perform that action at this time.
0 commit comments