Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/coding
diff options
context:
space:
mode:
authorVladimir Byko-Ianko <v.bykoianko@corp.mail.ru>2018-09-04 17:19:44 +0300
committermpimenov <mpimenov@users.noreply.github.com>2018-09-14 16:42:42 +0300
commitea3407d1ec6a2800353896fac481023dbc3f4854 (patch)
tree7e5b98a4bc3aefaf862565f6b8c514fbf2e7c47d /coding
parentc488f20bbaf9ea61b4321334b6e7d4443fbce05e (diff)
Explicit check that only little endian architectures are supported.
Diffstat (limited to 'coding')
-rw-r--r--coding/endianness.hpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/coding/endianness.hpp b/coding/endianness.hpp
index 103f6fa04b..2f0329d594 100644
--- a/coding/endianness.hpp
+++ b/coding/endianness.hpp
@@ -8,6 +8,10 @@
// #define ENDIAN_IS_BIG
+// @TODO(bykoianko) This method returns false since 05.12.2010. That means only little endian
+// architecture is supported. Now checks are added to generator and to app that only
+// little endian architecture is supported. All the usage of IsBigEndian(), ReverseByteOrder()
+// and SwapIfBigEndian() should be removed.
inline bool IsBigEndian()
{
#ifdef ENDIAN_IS_BIG
@@ -37,3 +41,10 @@ template <typename T> inline T SwapIfBigEndian(T t)
return t;
#endif
}
+
+inline bool IsLittleEndian()
+{
+ uint16_t const word = 0x0001;
+ char const * const b = reinterpret_cast<char const * const>(&word);
+ return b[0] == 0x1;
+}