From 69e0393399e4aba077f29b36611670dbe5813e27 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 10 May 2018 23:25:43 -0700 Subject: QByteArray::setNum: use the existing latin1 lowercasing table Not sure this makes the code faster, but it removes two functions. Change-Id: I5d0ee9389a794d80983efffd152d830da44b1bfe Reviewed-by: Lars Knoll --- src/corelib/tools/qbytearray.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 83b9f19094..7c601e1336 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -782,19 +782,6 @@ QByteArray qUncompress(const uchar* data, int nbytes) } #endif -static inline bool qIsUpper(char c) -{ - return c >= 'A' && c <= 'Z'; -} - -static inline char qToLower(char c) -{ - if (c >= 'A' && c <= 'Z') - return c - 'A' + 'a'; - else - return c; -} - /*! \class QByteArray \inmodule QtCore @@ -4136,9 +4123,10 @@ QByteArray &QByteArray::setNum(double n, char f, int prec) QLocaleData::DoubleForm form = QLocaleData::DFDecimal; uint flags = QLocaleData::ZeroPadExponent; - if (qIsUpper(f)) + char lower = latin1_lowercased[uchar(f)]; + if (f != lower) flags |= QLocaleData::CapitalEorX; - f = qToLower(f); + f = lower; switch (f) { case 'f': -- cgit v1.2.3