RE: Bug#1128946: tor FTBFS on big endian

Pranav P <[email protected]>
Newsgroups gmane.linux.debian.ports.s390
Message-ID <CO1PR15MB4841F6C19042F98A0E77B3CFA072A@CO1PR15MB4841.namprd15.prod.outlook.com>
Hi Peter,

Great that it's fixed :D
I also had a patch. I will share it here just for the sake
of mentioning what I figured out.

diff --git a/src/ext/polyval/polyval.c b/src/ext/polyval/polyval.c
index 9f64734e0f..73d9a452aa 100644
--- a/src/ext/polyval/polyval.c
+++ b/src/ext/polyval/polyval.c
@@ -84,7 +84,7 @@ static void pv_mul_y_h(polyval_t *);h
 /* =====
  * Endianness conversion for big-endian platforms
  */
-#ifdef WORDS_BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
 #ifdef __GNUC__
 #define bswap64(x) __builtin_bswap64(x)
 #define bswap32(x) __builtin_bswap32(x)
@@ -94,28 +94,28 @@ static inline uint64_t
 bswap64(uint64_t v)
 {
   return
-    ((value & 0xFF00000000000000) >> 56) |
-    ((value & 0x00FF000000000000) >> 48) |
-    ((value & 0x0000FF0000000000) >> 40) |
-    ((value & 0x000000FF00000000) >> 32) |
-    ((value & 0x00000000FF000000) >> 24) |
-    ((value & 0x0000000000FF0000) >> 16) |
-    ((value & 0x000000000000FF00) >> 8) |
-    ((value & 0x00000000000000FF));
+    ((v & 0xFF00000000000000) >> 56) |
+    ((v & 0x00FF000000000000) >> 40) |
+    ((v & 0x0000FF0000000000) >> 24) |
+    ((v & 0x000000FF00000000) >>  8) |
+    ((v & 0x00000000FF000000) <<  8) |
+    ((v & 0x0000000000FF0000) << 24) |
+    ((v & 0x000000000000FF00) << 40) |
+    ((v & 0x00000000000000FF) << 56);
 }
 static inline uint64_t
 bswap32(uint64_t v)
 {
   return
-    ((value & 0xFF000000) >> 24) |
-    ((value & 0x00FF0000) >> 16) |
-    ((value & 0x0000FF00) >> 8) |
-    ((value & 0x000000FF));
+    ((v & 0xFF000000) >> 24) |
+    ((v & 0x00FF0000) >>  8) |
+    ((v & 0x0000FF00) <<  8) |
+    ((v & 0x000000FF) << 24);
 }
 #endif
 #endif

-#ifdef WORDS_BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
 #define convert_byte_order64(x) bswap64(x)
 #define convert_byte_order32(x) bswap32(x)
 #else

Thanks & Regards,
Pranav
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.