[fflas-ffpack] 01/01: Apply patch to fix FTBFS on big endian architectures.

Tobias Hansen thansen at moszumanska.debian.org
Sat Jan 7 09:56:31 UTC 2017


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

thansen pushed a commit to branch _wip_fix_bigendian
in repository fflas-ffpack.

commit 392aefc9e924a1794c54c095b04b6a56fddd9c75
Author: Tobias Hansen <thansen at debian.org>
Date:   Sat Jan 7 10:55:04 2017 +0100

    Apply patch to fix FTBFS on big endian architectures.
---
 debian/changelog                         |   9 ++
 debian/patches/fix_ftbfs_bigendian.patch | 171 +++++++++++++++++++++++++++++++
 debian/patches/series                    |   1 +
 3 files changed, 181 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 496ca21..e0f2754 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+fflas-ffpack (2.2.2-3) unstable; urgency=medium
+
+  * Team upload.
+  * Add fix_ftbfs_bigendian.patch:
+    Apply patch from upstream pull request #72 to fix FTBFS
+    on big endian architectures. (Closes: #840454) 
+
+ -- Tobias Hansen <thansen at debian.org>  Sat, 07 Jan 2017 10:52:32 +0100
+
 fflas-ffpack (2.2.2-2) unstable; urgency=medium
 
   * debian/fflas-ffpack-common.install
diff --git a/debian/patches/fix_ftbfs_bigendian.patch b/debian/patches/fix_ftbfs_bigendian.patch
new file mode 100644
index 0000000..8dac23e
--- /dev/null
+++ b/debian/patches/fix_ftbfs_bigendian.patch
@@ -0,0 +1,171 @@
+From d224e983541d5a72531cd1148ef53c13706be280 Mon Sep 17 00:00:00 2001
+From 651cdb4725265e0578e9480a4717432ca074131c Mon Sep 17 00:00:00 2001
+From: Jerry James <loganjerry at gmail.com>
+Date: Wed, 4 Jan 2017 21:41:22 -0700
+Subject: [PATCH 1/2] Fix access to mpz_t limbs on big endian architectures
+         [PATCH 2/2] Be less obtuse about bit twiddling operations
+Bug: https://github.com/linbox-team/fflas-ffpack/issues/45
+Bug-Debian: https://bugs.debian.org/840454
+
+---
+ fflas-ffpack/field/rns-double-recint.inl | 25 ++++++++++++++++++
+ fflas-ffpack/field/rns-double.h          |  8 ++++++
+ fflas-ffpack/field/rns-double.inl        | 44 ++++++++++++++++++++++++++++++++
+ 3 files changed, 77 insertions(+)
+
+--- a/fflas-ffpack/field/rns-double-recint.inl
++++ b/fflas-ffpack/field/rns-double-recint.inl
+@@ -69,7 +69,11 @@
+ 					  //size_t maxs=std::min(k,(Aiter[j+i*lda].size())*sizeof(mp_limb_t)/2);// to ensure 32 bits portability
+ 
+ 					  for (;l<maxs;l++){
++#ifdef __FFLASFFPACK_HAVE_LITTLE_ENDIAN
+ 						  A_beta[l+idx*k]= m0_ptr[l];						  
++#else
++						  A_beta[l+idx*k]= m0_ptr[l^((sizeof(mp_limb_t)/2U)-1U)];
++#endif
+ 					  }
+ 					  for (;l<k;l++)
+ 						  A_beta[l+idx*k]=  0.;
+@@ -197,10 +201,17 @@
+ 					for (size_t l=0;l<k;l++){
+ 						uint64_t tmp=(uint64_t)A_beta[l+idx*k];
+ 						uint16_t* tptr= reinterpret_cast<uint16_t*>(&tmp);
++#ifdef __FFLASFFPACK_HAVE_LITTLE_ENDIAN
+ 						A0[l  ]= tptr[0];
+ 						A1[l+1]= tptr[1];
+ 						A2[l+2]= tptr[2];
+ 						A3[l+3]= tptr[3];
++#else
++						A0[l     ^ ((sizeof(mp_limb_t)/2U) - 1U)] = tptr[3];
++						A1[(l+1) ^ ((sizeof(mp_limb_t)/2U) - 1U)] = tptr[2];
++						A2[(l+2) ^ ((sizeof(mp_limb_t)/2U) - 1U)] = tptr[1];
++						A3[(l+3) ^ ((sizeof(mp_limb_t)/2U) - 1U)] = tptr[0];
++#endif
+ 					}
+ 					// see A0,A1,A2,A3 as a the gmp integers a0,a1,a2,a3
+ 					m0[0]->_mp_d= reinterpret_cast<mp_limb_t*>(&A0[0]);
+@@ -255,10 +266,17 @@
+ 					for (size_t l=0;l<k;l++){
+ 						uint64_t tmp=(uint64_t)A_beta[l+idx*k];					
+ 						uint16_t* tptr= reinterpret_cast<uint16_t*>(&tmp);
++#ifdef __FFLASFFPACK_HAVE_LITTLE_ENDIAN
+ 						A0[l  ]= tptr[0];
+ 						A1[l+1]= tptr[1];
+ 						A2[l+2]= tptr[2];
+ 						A3[l+3]= tptr[3];
++#else
++						A0[l     ^ ((sizeof(mp_limb_t)/2U) - 1U)] = tptr[3];
++						A1[(l+1) ^ ((sizeof(mp_limb_t)/2U) - 1U)] = tptr[2];
++						A2[(l+2) ^ ((sizeof(mp_limb_t)/2U) - 1U)] = tptr[1];
++						A3[(l+3) ^ ((sizeof(mp_limb_t)/2U) - 1U)] = tptr[0];
++#endif
+ 					
+ 					}
+ 					a0= reinterpret_cast<RecInt::ruint<K>*>(&A0[0]);
+--- a/fflas-ffpack/field/rns-double.h
++++ b/fflas-ffpack/field/rns-double.h
+@@ -179,8 +179,13 @@
+ 				}
+ 				*/
+ 				size_t l=0;
++#ifdef __FFLASFFPACK_HAVE_LITTLE_ENDIAN
+ 				for(;l<maxs;l++)
+ 					_crt_out[l+i*_ldm]=m0_ptr[l];
++#else
++				for(;l<maxs;l++)
++					_crt_out[l+i*_ldm]=m0_ptr[l ^ ((sizeof(mp_limb_t)/2U) - 1U)];
++#endif
+ 				for(;l<_ldm;l++)
+ 					_crt_out[l+i*_ldm]=0.;;
+ 				// chrono.stop();
+--- a/fflas-ffpack/field/rns-double.inl
++++ b/fflas-ffpack/field/rns-double.inl
+@@ -68,12 +68,25 @@
+ 						  //size_t maxs=std::min(k,(Aiter[j+i*lda].size())<<2);
+ 					  size_t maxs=std::min(k,(Aiter[j+i*lda].size())*sizeof(mp_limb_t)/2);// to ensure 32 bits portability
+ 
++#ifdef __FFLASFFPACK_HAVE_LITTLE_ENDIAN
+ 					  if (m0[0]->_mp_size >= 0)
+ 						  for (;l<maxs;l++)
+ 							  A_beta[l+idx*k]=  m0_ptr[l];
+ 					  else
+ 						  for (;l<maxs;l++)
+ 							  A_beta[l+idx*k]= - double(m0_ptr[l]);
++#else
++					  if (m0[0]->_mp_size >= 0)
++						  for (;l<maxs;l++) {
++							  size_t l2 = l ^ ((sizeof(mp_limb_t)/2U) - 1U);
++							  A_beta[l+idx*k]=  m0_ptr[l2];
++						  }
++					  else
++						  for (;l<maxs;l++) {
++							  size_t l2 = l ^ ((sizeof(mp_limb_t)/2U) - 1U);
++							  A_beta[l+idx*k]= - double(m0_ptr[l2]);
++						  }
++#endif
+ 					  for (;l<k;l++)
+ 						  A_beta[l+idx*k]=  0.;
+ 
+@@ -150,12 +163,25 @@
+ 				size_t l=0;
+ 					//size_t maxs=std::min(k,(Aiter[j+i*lda].size())<<2);
+ 				size_t maxs=std::min(k,(Aiter[j+i*lda].size())*sizeof(mp_limb_t)/2); // to ensure 32 bits portability
++#ifdef __FFLASFFPACK_HAVE_LITTLE_ENDIAN
+ 				if (m0[0]->_mp_size >= 0)
+ 					for (;l<maxs;l++)
+ 						A_beta[l+idx*k]=  m0_ptr[l];
+ 				else
+ 					for (;l<maxs;l++)
+ 						A_beta[l+idx*k]= - double(m0_ptr[l]);
++#else
++				if (m0[0]->_mp_size >= 0)
++					for (;l<maxs;l++) {
++						size_t l2 = l ^ ((sizeof(mp_limb_t)/2U) - 1U);
++						A_beta[l+idx*k]=  m0_ptr[l2];
++					}
++				else
++					for (;l<maxs;l++) {
++						size_t l2 = l ^ ((sizeof(mp_limb_t)/2U) - 1U);
++						A_beta[l+idx*k]= - double(m0_ptr[l2]);
++					}
++#endif
+ 				for (;l<k;l++)
+ 					A_beta[l+idx*k]=  0.;
+ 			}
+@@ -243,10 +269,17 @@
+ 				for (size_t l=0;l<k;l++){
+ 					uint64_t tmp=(uint64_t)A_beta[l+idx*k];
+ 					uint16_t* tptr= reinterpret_cast<uint16_t*>(&tmp);
++#ifdef __FFLASFFPACK_HAVE_LITTLE_ENDIAN
+ 					A0[l  ]= tptr[0];
+ 					A1[l+1]= tptr[1];
+ 					A2[l+2]= tptr[2];
+ 					A3[l+3]= tptr[3];
++#else
++					A0[l     ^ ((sizeof(mp_limb_t)/2U) - 1U)] = tptr[3];
++					A1[(l+1) ^ ((sizeof(mp_limb_t)/2U) - 1U)] = tptr[2];
++					A2[(l+2) ^ ((sizeof(mp_limb_t)/2U) - 1U)] = tptr[1];
++					A3[(l+3) ^ ((sizeof(mp_limb_t)/2U) - 1U)] = tptr[0];
++#endif
+ 				}
+ 					// see A0,A1,A2,A3 as a the gmp integers a0,a1,a2,a3
+ 				m0[0]->_mp_d= reinterpret_cast<mp_limb_t*>(&A0[0]);
+@@ -338,10 +371,17 @@
+ 				for (size_t l=0;l<k;l++){
+ 					uint64_t tmp=(uint64_t)A_beta[l+idx*k];
+ 					uint16_t* tptr= reinterpret_cast<uint16_t*>(&tmp);
++#ifdef __FFLASFFPACK_HAVE_LITTLE_ENDIAN
+ 					A0[l  ]= tptr[0];
+ 					A1[l+1]= tptr[1];
+ 					A2[l+2]= tptr[2];
+ 					A3[l+3]= tptr[3];
++#else
++					A0[l     ^ ((sizeof(mp_limb_t)/2U) - 1U)] = tptr[3];
++					A1[(l+1) ^ ((sizeof(mp_limb_t)/2U) - 1U)] = tptr[2];
++					A2[(l+2) ^ ((sizeof(mp_limb_t)/2U) - 1U)] = tptr[1];
++					A3[(l+3) ^ ((sizeof(mp_limb_t)/2U) - 1U)] = tptr[0];
++#endif
+ 				}
+ 					// see A0,A1,A2,A3 as a the gmp integers a0,a1,a2,a3
+ 				m0[0]->_mp_d= reinterpret_cast<mp_limb_t*>(&A0[0]);
diff --git a/debian/patches/series b/debian/patches/series
index e0658c4..af6ab4f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 fix-file-path-in-doc.patch
 pkg-config-bad-directive.patch
 skip-test-ftrsm.patch
+fix_ftbfs_bigendian.patch

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



More information about the debian-science-commits mailing list