[mathicgb] 06/06: debian/patches/big-endian.patch: New patch; fix tests on big-endian architectures.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Sat Aug 12 22:35:00 UTC 2017


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

dtorrance-guest pushed a commit to branch master
in repository mathicgb.

commit 1000ba83f8ea9e6c5114546f9778205dc7e9122e
Author: Doug Torrance <dtorrance at piedmont.edu>
Date:   Sat Aug 12 18:32:43 2017 -0400

    debian/patches/big-endian.patch: New patch; fix tests on big-endian
    architectures.
---
 debian/changelog                |  4 +++-
 debian/patches/big-endian.patch | 40 ++++++++++++++++++++++++++++++++++++++++
 debian/patches/series           |  1 +
 3 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 1aac957..d4d59ac 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -12,12 +12,14 @@ mathicgb (1.0~git20170606-1) unstable; urgency=medium
     - Use https in Format.
   * debian/mathicgb.docs
     - Rename from just 'docs' for clarity.
+  * debian/patches/big-endian.patch
+    - New patch; fix tests on big-endian architectures (Closes: #862090).
   * debian/patches/link-deps.patch
     - New patch; properly link against mathic and memtailor.
   * debian/rules
     - Remove call to dh_autoreconf; now default with debhelper 10.
 
- -- Doug Torrance <dtorrance at piedmont.edu>  Fri, 04 Aug 2017 21:31:09 -0400
+ -- Doug Torrance <dtorrance at piedmont.edu>  Sat, 12 Aug 2017 18:33:51 -0400
 
 mathicgb (1.0~git20170104-1) unstable; urgency=medium
 
diff --git a/debian/patches/big-endian.patch b/debian/patches/big-endian.patch
new file mode 100644
index 0000000..d863c91
--- /dev/null
+++ b/debian/patches/big-endian.patch
@@ -0,0 +1,40 @@
+Description: Fix tests on big-endian architectures.
+Origin: https://github.com/Macaulay2/mathicgb/pull/9/commits/d8ae074
+Last-Update: 2017-08-12
+
+--- a/src/mathicgb/MonoMonoid.hpp
++++ b/src/mathicgb/MonoMonoid.hpp
+@@ -582,13 +582,9 @@
+       MATHICGB_ASSERT(i == varCount() / 2 || access(a, i*2+1) >= 0);
+       
+       uint64 A, B, AB;
+-      // We have to use std::memcpy here because just casting to a int64 breaks
+-      // the strict aliasing rule which implies undefined behavior. Both MSVC and
+-      // gcc don't actually call memcpy here. MSVC is a tiny bit slower for this
+-      // code than for casting while GCC seems to be exactly the same speed.
+-      std::memcpy(&A, ptr(a, i*2), 8);
+-      std::memcpy(&B, ptr(b, i*2), 8);
+-      std::memcpy(&AB, ptr(ab, i*2), 8);
++      A = *ptr(a, i*2) | (((uint64)*ptr(a, i*2 + 1)) << 32);
++      B = *ptr(b, i*2) | (((uint64)*ptr(b, i*2 + 1)) << 32);
++      AB = *ptr(ab, i*2) | (((uint64)*ptr(ab, i*2 + 1)) << 32);
+       orOfXor |= AB ^ (A + B);
+     }
+     MATHICGB_ASSERT((orOfXor == 0) == isProductOf(a, b, ab));
+@@ -608,11 +604,11 @@
+     uint64 orOfXor = 0;
+     for (VarIndex i = varCount() / 2; i != beforeEntriesIndexBegin(); --i) {
+       uint64 A1, A2, B, A1B, A2B;
+-      std::memcpy(&A1, ptr(a1, i*2), 8);
+-      std::memcpy(&A2, ptr(a2, i*2), 8);
+-      std::memcpy(&B, ptr(b, i*2), 8);
+-      std::memcpy(&A1B, ptr(a1b, i*2), 8);
+-      std::memcpy(&A2B, ptr(a2b, i*2), 8);
++      A1 = *ptr(a1, i*2) | (((uint64)*ptr(a1, i*2 + 1)) << 32);
++      A2 = *ptr(a2, i*2) | (((uint64)*ptr(a2, i*2 + 1)) << 32);
++      B = *ptr(b, i*2) | (((uint64)*ptr(b, i*2 + 1)) << 32);
++      A1B = *ptr(a1b, i*2) | (((uint64)*ptr(a1b, i*2 + 1)) << 32);
++      A2B = *ptr(a2b, i*2) | (((uint64)*ptr(a2b, i*2 + 1)) << 32);
+       orOfXor |= (A1B ^ (A1 + B)) | (A2B ^ (A2 + B));
+     }
+     MATHICGB_ASSERT
diff --git a/debian/patches/series b/debian/patches/series
index 45ffe61..9df8cc7 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 link-deps.patch
+big-endian.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mathicgb.git



More information about the debian-science-commits mailing list