1
0

patch-mpi_longlong_h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. --- gnupg-1.4.9.orig/mpi/longlong.h 2007-10-23 11:15:14.000000000 +0200
  2. +++ gnupg-1.4.9/mpi/longlong.h 2009-06-19 19:16:25.000000000 +0200
  3. @@ -706,18 +706,35 @@ extern USItype __udiv_qrnnd ();
  4. #endif /* __m88110__ */
  5. #endif /* __m88000__ */
  6. +/* Test for gcc >= maj.min, as per __GNUC_PREREQ in glibc */
  7. +#if defined (__GNUC__) && defined (__GNUC_MINOR__)
  8. +#define __GNUC_PREREQ(maj, min) \
  9. + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
  10. +#else
  11. +#define __GNUC_PREREQ(maj, min) 0
  12. +#endif
  13. +
  14. /***************************************
  15. ************** MIPS *****************
  16. ***************************************/
  17. #if defined (__mips__) && W_TYPE_SIZE == 32
  18. -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7
  19. +#if __GNUC_PREREQ (4,4)
  20. +#define umul_ppmm(w1, w0, u, v) \
  21. + do { \
  22. + UDItype __ll = (UDItype)(u) * (v); \
  23. + w1 = __ll >> 32; \
  24. + w0 = __ll; \
  25. + } while (0)
  26. +#endif
  27. +#if !defined (umul_ppmm) && __GNUC_PREREQ (2,7)
  28. #define umul_ppmm(w1, w0, u, v) \
  29. __asm__ ("multu %2,%3" \
  30. : "=l" ((USItype)(w0)), \
  31. "=h" ((USItype)(w1)) \
  32. : "d" ((USItype)(u)), \
  33. "d" ((USItype)(v)))
  34. -#else
  35. +#endif
  36. +#if !defined (umul_ppmm)
  37. #define umul_ppmm(w1, w0, u, v) \
  38. __asm__ ("multu %2,%3 \n" \
  39. "mflo %0 \n" \
  40. @@ -735,14 +752,24 @@ extern USItype __udiv_qrnnd ();
  41. ************** MIPS/64 **************
  42. ***************************************/
  43. #if (defined (__mips) && __mips >= 3) && W_TYPE_SIZE == 64
  44. -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7
  45. +#if __GNUC_PREREQ (4,4)
  46. +#define umul_ppmm(w1, w0, u, v) \
  47. + do { \
  48. + typedef unsigned int __ll_UTItype __attribute__((mode(TI))); \
  49. + __ll_UTItype __ll = (__ll_UTItype)(u) * (v); \
  50. + w1 = __ll >> 64; \
  51. + w0 = __ll; \
  52. + } while (0)
  53. +#endif
  54. +#if !defined (umul_ppmm) && __GNUC_PREREQ (2,7)
  55. #define umul_ppmm(w1, w0, u, v) \
  56. __asm__ ("dmultu %2,%3" \
  57. : "=l" ((UDItype)(w0)), \
  58. "=h" ((UDItype)(w1)) \
  59. : "d" ((UDItype)(u)), \
  60. "d" ((UDItype)(v)))
  61. -#else
  62. +#endif
  63. +#if !defined (umul_ppmm)
  64. #define umul_ppmm(w1, w0, u, v) \
  65. __asm__ ("dmultu %2,%3 \n" \
  66. "mflo %0 \n" \