Commit 0cffd659 authored by Marc Mutz's avatar Marc Mutz
Browse files

Drop hand-rolled ASCII conversion from QAbstractConcatenable::convertFromAscii()


QUtf8::convertToUnicode() contains a SIMD-enabled
ASCII fast-path already which is likely faster
than what the compiler will emit for the old code
here.

Change-Id: I6afae9689424eb53a9f7c01359cc4f57ffcead26
Reviewed-by: default avatarOlivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Showing with 1 addition and 15 deletions
...@@ -110,25 +110,11 @@ QT_BEGIN_NAMESPACE ...@@ -110,25 +110,11 @@ QT_BEGIN_NAMESPACE
*/ */
void QAbstractConcatenable::convertFromAscii(const char *a, int len, QChar *&out) Q_DECL_NOTHROW void QAbstractConcatenable::convertFromAscii(const char *a, int len, QChar *&out) Q_DECL_NOTHROW
{ {
if (len == -1) { if (Q_UNLIKELY(len == -1)) {
if (!a) if (!a)
return; return;
while (*a && uchar(*a) < 0x80U)
*out++ = QLatin1Char(*a++);
if (!*a)
return;
len = int(strlen(a)); len = int(strlen(a));
} else {
int i;
for (i = 0; i < len && uchar(a[i]) < 0x80U; ++i)
*out++ = QLatin1Char(a[i]);
if (i == len)
return;
a += i;
len -= i;
} }
// we need to complement with UTF-8 appending
out = QUtf8::convertToUnicode(out, a, len); out = QUtf8::convertToUnicode(out, a, len);
} }
......
Supports Markdown
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