summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qendian.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix qbswap calls for Big Endian targetsVille Voutilainen2019-01-051-2/+2
| | | | | | | Task-number: QTBUG-71945 Change-Id: I5356f8e32d00ea591b1f65cdd4111276fcf876ac Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Khem Raj <raj.khem@gmail.com>
* Fix compilation of qendian's qswap specializations on gcc 4.8Ville Voutilainen2018-11-291-6/+6
| | | | | | | Task-number: QTBUG-71945 Change-Id: Icf2b75c72946f57ebffc880c9238531dea13ab5b Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* qendian: Fix float conversionsIvan Komissarov2018-10-281-0/+26
| | | | | | | | | Since Qt 5.10, qTo/FromBig/LittleEndian<float/double> stopped working. It may be confusing, but big endian floats do exist, so not to break old code, we should support them. Change-Id: I21cdbc7f48ec030ce3d82f1cd1aad212f0fe5dd0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add ++/--/min/max to QSpecialIntegerErik Verbruggen2018-08-171-0/+40
| | | | | | | | | | | | | Add both prefix and postfix versions of the increment/decrement operators, and a static constexpr min/max which returns the minimum/maximumm values that can be stored in the QSpecialInteger. These latter functions are useful to define constants, e.g.: typedef quint8_be IPv4_TTL; static constexpr TTL_TO_DROP = IPv4_TTL::min(); Change-Id: I825a279feb68b93572765a9fdb5aa7b06d1be35b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add qbswap for a memory regionThiago Macieira2018-07-041-0/+25
| | | | | | | | | | | | The compiler was generating some vectorized code for qresource.cpp but it wasn't very efficient. So improve upon it and make use in other places where we read UTF-16BE strings. [ChangeLog][QtCore] Added an overload of q{To,From}{Big,Little}Endian that operates on a memory region. Change-Id: I6a540578e810472bb455fffd1531fa2f1d724dfc Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* doc: Add missing template textMartin Smith2017-12-041-1/+3
| | | | | | | | | | | | There are two fake classes in qendian.h that exist only documenting a lot of operator functions, but now that clang is being used to parse all C++ code, when a class is a template class, clangqdoc must see its template stuff to recognize template type T, for example. Hence, this update adds template<typename T> to some fake class declarations used only for documentation purposes. ie, inside #ifdef Q_CLANG_QDOC. Change-Id: I1988b77cd7f3bb97067e7107dd00de34770e9fed Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Move endian-specific integer types to public qtendian headerAllan Sandfeld Jensen2017-07-091-0/+121
| | | | | | | | | The classes have recently been cleaned up to be ready for being made public, and this change adds the final documentation. The classes are already used in qjson, qtdeclarative and some image format decoders. Change-Id: Ib6df89f1119162c5bad7a08e9b6f843a2db4040f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Mark bswap and related methods constexprAllan Sandfeld Jensen2017-06-201-81/+33
| | | | | | | | | Marks the bswap methods constexpr and removes the special versions explicitly using builtins as both clang and gcc automatically recognizes bswap code and replaces it with builtins. Change-Id: I07258431ac2588f6046682ffb9c832e650faf66a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove duplicated QT_HAS_BUILTIN defineBogDan Vatra2016-06-211-6/+0
| | | | | | | | | QT_HAS_BUILTIN is already defined in qcompilerdetection.h which is included in qglobal.h which is included in this header file. Task-number: QTBUG-54068 Change-Id: I46c2e13d85fc21d3e6c426d0f35a584b21ae792b Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Use void instead of uchar in the endian-swapping function parametersv5.7.0-rc1Thiago Macieira2016-05-261-28/+29
| | | | | | | | | This allows us to pass pointers to storage that is not an array of uchar, which it hardly ever is. Change-Id: Ifea6e497f11a461db432ffff14490d2c2df21906 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Merge remote-tracking branch 'origin/5.6.1' into 5.7.0Liang Qi2016-05-261-4/+20
|\ | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qsimd_p.h src/network/socket/qnativesocketengine_winrt.cpp Change-Id: I2765b671664c2a84839b2f88ba724fdf0c1fa7c6
| * Replace qUnaligned{Load,Store} with the existing q{To,From}Unalignedv5.6.1-1v5.6.1Thiago Macieira2016-05-251-10/+20
| | | | | | | | | | | | | | | | Move the Q_ALWAYS_INLINE and forcing of __builtin_memcpy to the existing functions. Change-Id: Icaa7fb2a490246bda156ffff143c137e520eea79 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Add Intel copyright to files that Intel has had non-trivial contributionThiago Macieira2016-01-211-0/+1
| | | | | | | | | | | | | | | | | | I wrote a script to help find the files, but I reviewed the contributions manually to be sure I wasn't claiming copyright for search & replace, adding Q_DECL_NOTHROW or adding "We mean it" headers. Change-Id: I7a9e11d7b64a4cc78e24ffff142b506368fc8842 Reviewed-by: Lars Knoll <lars.knoll@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>
* | Add the QT_HAS_xxx macros for post-C++11 feature testingThiago Macieira2015-10-161-8/+0
|/ | | | | | | | And for compiler extensions. QT_HAS_BUILTIN and QT_HAS_ATTRIBUTE will come in handy. Change-Id: I255870833a024a36adf6ffff13ecf06624bfc1ef 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>
* Merge "Merge remote-tracking branch 'origin/5.4' into dev" into refs/staging/devSimon Hausmann2015-01-211-2/+10
|\
| * Fix compilation with Apple Clang 425Thiago Macieira2015-01-171-2/+10
| | | | | | | | | | | | | | | | | | This version was based on Clang mainline between releases 3.1 and 3.2, which means it has part of 3.2 features but not all. One of the missing features is __builtin_bswap16. Change-Id: Ic5d393bfd36e48a193fcffff13b95664c7f664de Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* | Implement the unaligned byteswap functions using the aligned onesThiago Macieira2015-01-211-191/+63
|/ | | | | | | | | | | | | | This leaves the decision on whether to do unaligned stores to the compiler, as opposed to forcing it by ourselves. Since we're now implementing them using two calls, this invalidates the compiler bug that triggered the #ifdef for Sun Studio (whatever that bug was). Change-Id: I4e494ca860a15b9427b2a3000921bf5d92cbb5ef Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Use the GCC and Clang __builtin_bswap intrinsics in qbswapThiago Macieira2014-12-201-13/+13
| | | | | | | | | | | | | | | | Glibc will use the intrinsics for 32- and 64-bit, but didn't for 16-bit (probably because GCC didn't document it until version 4.8), so this commit will make us access the intrinsics directly the intrisincs for all type sizes. Additionally, this will get us access to the compiler intrisics even without Glibc, such as when building against uclibc or Bionic. Another benefit is that both Clang and ICC will use the MOVBE instruction on Atom and Haswell architectures. Change-Id: I39d1891f479887d719d69ebe4ac92ac9bfeda8af Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* 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>
* Fix tst_qtendian autotest build for WEC7.Janne Anttila2013-05-301-1/+4
| | | | | | | | | | | | | | | | | MSVC2008 compiler fo ARM targets fail to compile qToUnaligned when using sizeof(T) inside memcpy fynction. The compiler fails at least when the code is reached through the following macros and templates: -> tst_QtEndian::toLittleEndian -> qToLittleEndian(T src, uchar *dest) -> qToUnaligned(const T src, uchar *dest) The above sequence produces internal compiler error with MSVC2008/ARM builds when called from tst_endian. As a workaround sizeof(T) is called outside memcpy function. Change-Id: Ib4d382c2cebecb6e54bb99fc8fad72db93825fcd Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.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>
* 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>
* Removing duplicate includesSergio Ahumada2012-09-091-2/+0
| | | | | | | Do not include a header more than once Change-Id: Ia2e5d66e72988ad833cf5177a3f8aa988bf510e9 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Need #include <string.h> to use memcpyShawn Rutledge2012-09-031-0/+1
| | | | | | | | Caused a compile failure in qtmultimedia. Change-Id: I73652d93848c2005c0132d24bb0d269e7b450396 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* string.h is needed for memcpy()Oswald Buddenhagen2012-08-021-0/+2
| | | | | | | | ... which is used by some template code. apparently, the glibc on my rather recent system removed some implicit includes again. Change-Id: I9f85362e54a42cccc1e743f2b27bcdb6a90162e3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Deprecate qMemCopy/qMemSet in favour of their stdlib equivilents.Robin Burchell2012-04-111-1/+1
| | | | | | | | | | | | | | | | | | Just like qMalloc/qRealloc/qFree, there is absolutely no reason to wrap these functions just to avoid an include, except to pay for it with worse runtime performance. On OS X, on byte sizes from 50 up to 1000, calling memset directly is 28-15% faster(!) than adding an additional call to qMemSet. The advantage on sizes above that is unmeasurable. For qMemCopy, the benefits are a little more modest: 16-7%. Change-Id: I98aa92bb765aea0448e3f20af42a039b369af0b3 Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com> Reviewed-by: John Brooks <john.brooks@dereferenced.net> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Enable endianness conversions on q(u)int8João Abecasis2012-03-251-0/+16
| | | | | | | | | | | | | | | | | | Lack of support for these types is not a real issue as endian conversions on byte-sized types are no-ops. Still, the conversions are useful as they facilitate writing of generic code. They can also be used explicitly as a way to document in code an endian-specific binary format: uchar *data; quint8 tag = qFromLittleEndian<quint8>(data++); quint32 size = qFromLittleEndian<quint32>(data); This commit also adds a test for functions documented in the QtEndian header. Change-Id: I2f6c876ce89d2adb8c03a1c8a25921d225bf6f92 Reviewed-by: Thiago Macieira <thiago.macieira@intel.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>
* Fix the build for QUuidLiang Qi2011-05-271-0/+5
| | | | | | | | | | | Add a quint8 specialization for qbswap. Reviewed-by: Bradley T. Hughes (cherry picked from commit 32a583b575da1b387955734ccf36b0a93de37670) Change-Id: I7dae5e47565ed30de960983649e5c214e0303fe3 Reviewed-on: http://codereview.qt.nokia.com/171 Reviewed-by: Liang Qi <liang.qi@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/+370
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