diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2018-05-10 23:25:43 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2018-05-13 22:39:26 +0000 |
commit | 69e0393399e4aba077f29b36611670dbe5813e27 (patch) | |
tree | 42463ab40da81f60ced5bad918cf7cee5545b69e /src/corelib/tools/qbytearray.cpp | |
parent | 8c029e98bf668725979424766c0bbbfc012448b3 (diff) |
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 <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/tools/qbytearray.cpp')
-rw-r--r-- | src/corelib/tools/qbytearray.cpp | 18 |
1 files 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': |