Package: stringencoders
Version: 3.10.3+git20160118-1
Severity: important
Tags: sid + patch
Justification: FTBFS
User: debian-m...@lists.debian.org
Usertags: mips-patch
Forwarded: https://github.com/client9/stringencoders/pull/47

Hi,

After removing -Werror from configure.ac this package still FTBFS on mips
(big-endian) with following error:
> FAIL: modp_numtoa_test
> ======================
>
> modp_numtoa_test.c ............ASSERTION FAILED: modp_numtoa_test.c:494 
> 10000000 != 00000001
> FAIL modp_numtoa_test (exit status: 1)

modp_uitoa16 function is converting a number into string by right shifting the 
input value.
On big-endian the result was reversed because of wrong shifting.
There is no need to separate the code for big and little endian. The bitwise
operators abstract away the endianness.

With attached patch I was able to build stringencoders successfully on mips.

Thanks,
Daniel
--- stringencoders-3.10.3+git20160118.orig/src/modp_numtoa.c
+++ stringencoders-3.10.3+git20160118/src/modp_numtoa.c
@@ -302,15 +302,6 @@ size_t modp_dtoa2(double value, char* st
     return (size_t)(wstr - str);
 }
 
-
-#include "config.h"
-
-/* You can get rid of the include, but adding... */
-/* if on motoral, sun, ibm; uncomment this */
-/* #define WORDS_BIGENDIAN 1 */
-/* else for Intel, Amd; uncomment this */
-/* #undef WORDS_BIGENDIAN */
-
 char* modp_uitoa16(uint32_t value, char* str, int isfinal)
 {
     static const char* hexchars = "0123456789ABCDEF";
@@ -321,8 +312,6 @@ char* modp_uitoa16(uint32_t value, char*
      *  Each line is independent than the previous, so
      *    even dumb compilers can pipeline without loop unrolling
      */
-#ifndef WORDS_BIGENDIAN
-    /* x86 */
     str[0] = hexchars[(value >> 28) & 0x0000000F];
     str[1] = hexchars[(value >> 24) & 0x0000000F];
     str[2] = hexchars[(value >> 20) & 0x0000000F];
@@ -331,17 +320,6 @@ char* modp_uitoa16(uint32_t value, char*
     str[5] = hexchars[(value >>  8) & 0x0000000F];
     str[6] = hexchars[(value >>  4) & 0x0000000F];
     str[7] = hexchars[(value ) & 0x0000000F];
-#else
-    /* sun, motorola, ibm */
-    str[0] = hexchars[(value ) & 0x0000000F];
-    str[1] = hexchars[(value >>  4) & 0x0000000F];
-    str[2] = hexchars[(value >>  8) & 0x0000000F];
-    str[3] = hexchars[(value >> 12) & 0x0000000F];
-    str[4] = hexchars[(value >> 16) & 0x0000000F];
-    str[5] = hexchars[(value >> 20) & 0x0000000F];
-    str[6] = hexchars[(value >> 24) & 0x0000000F];
-    str[7] = hexchars[(value >> 28) & 0x0000000F];
-#endif
 
     if (isfinal) {
         str[8] = '\0';

Reply via email to