Skip to content

Commit 9358432

Browse files
committed
Removing unnecessary if check in utf8_to_utf16 conversion function.
1 parent 6e9080e commit 9358432

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Release/src/utilities/asyncrt_utils.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -286,14 +286,13 @@ utf16string __cdecl conversions::utf8_to_utf16(const std::string &s)
286286
}
287287
else
288288
{
289-
if ((*src & BIT8) != 0 && (*src & BIT7) == 0)
289+
unsigned char numContBytes = 0;
290+
uint32_t codePoint;
291+
if ((*src & BIT7) == 0)
290292
{
291293
throw std::range_error("UTF-8 string character can never start with 10xxxxxx");
292294
}
293-
294-
unsigned char numContBytes = 0;
295-
uint32_t codePoint;
296-
if ((*src & BIT6) == 0) // 2 byte character, 0x80 to 0x7FF
295+
else if ((*src & BIT6) == 0) // 2 byte character, 0x80 to 0x7FF
297296
{
298297
codePoint = *src & LOW_5BITS;
299298
numContBytes = 1;

0 commit comments

Comments
 (0)