[med-svn] [seqan2] 01/03: New upstream version 2.3.2.000platform-issues1-66a8baf+dfsg

Michael Crusoe misterc-guest at moszumanska.debian.org
Wed Oct 25 12:33:23 UTC 2017


This is an automated email from the git hooks/post-receive script.

misterc-guest pushed a commit to branch experimental
in repository seqan2.

commit 275e0e895d31f5ee77c279260a4105c07ec5d680
Author: Michael R. Crusoe <michael.crusoe at gmail.com>
Date:   Wed Oct 25 04:06:09 2017 -0700

    New upstream version 2.3.2.000platform-issues1-66a8baf+dfsg
---
 include/seqan/bam_io.h              |  1 +
 include/seqan/basic/basic_stream.h  |  5 +++--
 include/seqan/platform.h            | 26 ++++++++++++++------------
 include/seqan/stream/tokenization.h |  5 +++--
 4 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/include/seqan/bam_io.h b/include/seqan/bam_io.h
index f9f9842..b503368 100644
--- a/include/seqan/bam_io.h
+++ b/include/seqan/bam_io.h
@@ -42,6 +42,7 @@
 // Prerequisites.
 // ===========================================================================
 
+#include <seqan/platform.h>
 #include <seqan/basic.h>
 #include <seqan/file.h>
 #include <seqan/sequence.h>
diff --git a/include/seqan/basic/basic_stream.h b/include/seqan/basic/basic_stream.h
index d277730..ee4a46c 100644
--- a/include/seqan/basic/basic_stream.h
+++ b/include/seqan/basic/basic_stream.h
@@ -1212,10 +1212,11 @@ appendRawPod(TTarget & target, TValue val)
 
 template <typename TTarget, typename TValue>
 inline std::enable_if_t<!std::is_arithmetic<TValue>::value>
-appendRawPod(TTarget & target, TValue const & val)
+appendRawPod(SEQAN_UNUSED TTarget & target, SEQAN_UNUSED TValue const & val)
 {
 #if SEQAN_BIG_ENDIAN
-    #error "You are serialising a data structure on big endian architecture that needs a custom writer. THIS IS A BUG!"
+    static_assert(std::is_arithmetic<TValue>::value /*false*/,
+                  "You are serialising a data structure on big endian architecture that needs a custom writer. THIS IS A BUG!");
 #else
     appendRawPodImpl(target, val);
 #endif
diff --git a/include/seqan/platform.h b/include/seqan/platform.h
index 774549a..365f5de 100644
--- a/include/seqan/platform.h
+++ b/include/seqan/platform.h
@@ -465,15 +465,15 @@ typedef int8_t __int8;     // nolint
 #endif
 
 // BYTE-ORDER DETECTION (default is little-endian)
-#ifndef SEQAN_BIG_ENDIAN
-    #ifdef __GLIBC__
-        #include <endian.h>
-    #endif
+#ifdef __GLIBC__
+    #include <endian.h>
+#endif // __GLIBC__
 
-    #if defined(__FreeBSD__) || (defined(__has_include) && __has_include(<sys/endian.h>))
-        #include <sys/endian.h>
-    #endif
+#if defined(__FreeBSD__) || (defined(__has_include) && __has_include(<sys/endian.h>))
+    #include <sys/endian.h>
+#endif // defined(__FreeBSD__)
 
+#ifndef SEQAN_BIG_ENDIAN
     #if (defined( _BYTE_ORDER  ) && ( _BYTE_ORDER   ==        _BIG_ENDIAN  )) || \
         (defined(__BYTE_ORDER  ) && (__BYTE_ORDER   ==       __BIG_ENDIAN  )) || \
         (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)) || \
@@ -488,7 +488,7 @@ template <typename T>
 constexpr void ensure_little_endian(T &)
 {}
 
-#if SEQAN_BIG_ENDIAN
+#if !SEQAN_BIG_ENDIAN
 inline void ensure_little_endian(int16_t & in)
 {
     in = htole16(in);
@@ -515,14 +515,16 @@ inline void ensure_little_endian(uint64_t & in)
 }
 inline void ensure_little_endian(float & in)
 {
-    in = reinterpret_cast<float>(htole32(reinterpret_cast<uint32_t>(in)));
+    uint32_t tmp = htole32(*reinterpret_cast<uint32_t*>(&in));
+    char *out = reinterpret_cast<char*>(&in);
+    *out = *reinterpret_cast<char*>(&tmp);
 }
 inline void ensure_little_endian(double & in)
 {
-    in = reinterpret_cast<double>(htole64(reinterpret_cast<uint64_t>(in)));
+    uint64_t tmp = htole64(*reinterpret_cast<uint64_t*>(&in));
+    char *out = reinterpret_cast<char*>(&in);
+    *out = *reinterpret_cast<char*>(&tmp);
 }
-//TODO long double
-
 #endif // SEQAN_BIG_ENDIAN
 
 #endif // HEADER GUARD
diff --git a/include/seqan/stream/tokenization.h b/include/seqan/stream/tokenization.h
index 9595cb4..96c8ca3 100644
--- a/include/seqan/stream/tokenization.h
+++ b/include/seqan/stream/tokenization.h
@@ -412,10 +412,11 @@ readRawPod(TValue & value, TFwdIterator &srcIter)
 
 template <typename TValue, typename TFwdIterator>
 inline std::enable_if_t<!std::is_arithmetic<TValue>::value>
-readRawPod(TValue & value, TFwdIterator &srcIter)
+readRawPod(SEQAN_UNUSED TValue & value, SEQAN_UNUSED TFwdIterator &srcIter)
 {
 #if SEQAN_BIG_ENDIAN
-    #error "You are deserialising a data structure on big endian architecture that needs a custom reader. THIS IS A BUG!"
+    static_assert(std::is_arithmetic<TValue>::value,
+                  "You are deserialising a data structure on big endian architecture that needs a custom reader. THIS IS A BUG!");
 #else
     readRawPodImpl(value, srcIter);
 #endif

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/seqan2.git



More information about the debian-med-commit mailing list