summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qalgorithms.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix documentation of qLess and qGreaterOlivier Goffart2016-03-291-9/+3
| | | | | | | | While compiling with clang, everything has to be valid code. So the types have to be correct Change-Id: I73f5e493a19e27b1a459f92ea37480f3329a1c0a Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* qCount{Leading,Trailing}ZeroBits: Use __builtin_clzs for 16-bitThiago Macieira2015-12-051-0/+8
| | | | | | | | | | | | | | | If possible. The BSF/BSR/TZCNT/LZCNT Intel instruction does not exist for 8-bit. And it's a good idea to use the 32-bit instruction instead of the 16-bit one for that case, to avoid the Length Changing Prefix (LCP). GCC doesn't allow us to use __builtin_cl[tz]s unless BMI is active, while ICC generates the same code either way (Clang understands __has_builtin). Change-Id: I8de47ed6c7be4847b99bffff141c91603c7024dc Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
* Fix permissions on qalgorithms.hThiago Macieira2015-08-251-0/+0
| | | | | | | | Commit 046f3254838715079b853ab4e15eed4ef464fb30 accidentally made it executable. Change-Id: I7de033f80b0e4431b7f1ffff13fc9872fa64ae9d Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* Fix compilation with ICC on WindowsThiago Macieira2015-08-251-5/+5
| | | | | | | | | | | | Unlike MSVC, ICC *does* support constexpr, but on Windows it will not define __GNUC__, so we ended up in the multi-line alternative. That is not permitted in C++11, only in C++14. qalgorithms.h(659): error: statement may not appear in a constexpr function Change-Id: I7de033f80b0e4431b7f1ffff13fc96245ee9a846 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* Adds qFindFirstSetBit() and qFindLastSetBit().Glen Mabey2015-03-281-0/+125
| | | | | | | | | | | | Two new function families have been added: qFindFirstSetBit() and qFindLastSetBit() for a variety of integer sizes. Fast implementations are included for most platforms. [ChangeLog][QtCore][QtAlgorithms] Added qFindFirstSetBit() and qFindLastSetBit(). Change-Id: I89d9d1637ea26070aee5a60be95be1b51bfc84dc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add Q_DECL_CONST_FUNCTION and Q_DECL_NOTHROW to qPopulationCountMarc Mutz2015-02-121-5/+5
| | | | | Change-Id: I7602936b7064d6a87cd9fbfc4ab22a8fc881b9e9 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Disable the warning about deprecation inside qalgorithms.hThiago Macieira2015-01-061-2/+4
| | | | | | | | | | | Since some of the algorithms use other ones, we should not warn about those. The warnings are supposed to happen only in user code. Warnings obtained with GCC 5. The Clang change is just to be on the safe side. Change-Id: If295899f6ff6534de7b19741d33efc0b5c4c912c Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Used QT_DEPRECATED_X in QtAlgorithmsKeith Gardner2013-10-211-43/+43
| | | | | | | | Made all of the deprecated functions in QtAlgorithms now use QT_DEPRECATED_X with helpful deprecation messages. Change-Id: I3358e44b8c1f15eeb4689ab02b1802a07d04fc09 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Mark most of the contents of QtAlgorithms as deprecated.Robin Burchell2013-09-211-43/+51
| | | | | | | | | This is done per the mailing list discussion at http://www.mail-archive.com/development@qt-project.org/msg01603.html Change-Id: Ic31c052e7f35c576250bf11826ca82e371142c82 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Revert "Reimplement qBinaryFind in terms of std::lower_bound"Giuseppe D'Angelo2013-09-141-3/+2
| | | | | | | | | | | | | | After a bit of discussion, we should actually deprecate qBinaryFind too. This puts the old code back (to avoid behavior changes / source breaks). This reverts commit 23d7f6ee5dea3dd9f47f4ab538b25dc0ffe3df92. Task-number: QTBUG-33473 Change-Id: I7f7d25171e14061e51543c501c30a7b6b184a8fd Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Reimplement qBinaryFind in terms of std::lower_boundGiuseppe D'Angelo2013-09-071-2/+3
| | | | | | | | qBinaryFind is not going to be deprecated now. This commits prepares the deprecation of the qLowerBound function. Change-Id: I6131582c981c151d632ad44305fe602c76735e14 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Compile with Clang.Morten Johan Sørvig2013-04-181-4/+17
| | | | | | | | | | This bug surfaced after we switched Mac over to use clang's libstdc++, which has __builtin_popcount but does not mark it as constexpr. Change-Id: I4260af48b00c6db3322e52fb113075d305b1e1ec Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* With GCC, use __builtin_popcount{,l,ll} for qPopulationCount()Marc Mutz2013-04-031-0/+16
| | | | | Change-Id: Ied7a98fa17404f1d9678bfbc1ced4817ab52f40e Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Add qPopulationCount() function, extracted from QBitArrayMarc Mutz2013-04-031-0/+38
| | | | | | | | | | | | | This functionality is used in multiple places in Qt itself, so it makes sense to have a global function for this. This also allows to map this onto specialized assembler instructions, should an architecture provide them, later on. Also added comprehensive tests, using a 4-bit lookup-table implementation as a reference. Change-Id: I8c4ea72cce54506ebb9fbe61141dbb5f1b7a660f Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Remove QT_{BEGIN,END}_HEADER macro usageSergio Ahumada2013-01-291-4/+0
| | | | | | | | | | | The macro was made empty in ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb and is no longer necessary or used. Discussed-on: http://lists.qt-project.org/pipermail/development/2013-January/009284.html Change-Id: Id2bb2e2cabde059305d4af5f12593344ba30f001 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Replace macro qdoc with Q_QDOCDebao Zhang2013-01-081-1/+1
| | | | | | | | Both qdoc and Q_QDOC are used in source code, which looks not good. Change-Id: I4f3a71670278b0758d92bfa5db086a07e1b1acfd Reviewed-by: hjk <qthjk@ovi.com> Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove use of QT_MODULE from libraryGunnar Sletta2012-01-251-1/+0
| | | | | | | | | | These defines were there to aid in the commercial licensing scheme we used long ago, and are no longer needed. Keep a QT_MODULE(x) define so other modules continue compiling. Change-Id: I8fd76cd5270df8f14aee746b6cf32ebf7c23fec7 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update licenseheader text in source files for qtbase Qt moduleJyri Tahtela2011-05-241-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+526
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12