mldonkey-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mldonkey-commits] mldonkey distrib/ChangeLog src/utils/lib/Crypto...


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey distrib/ChangeLog src/utils/lib/Crypto...
Date: Sat, 23 Oct 2010 18:23:38 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Changes by:     spiralvoice <spiralvoice>       10/10/23 18:23:38

Modified files:
        distrib        : ChangeLog 
        src/utils/lib  : CryptoPP.cc CryptoPP.h 

Log message:
        patch #7319

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1488&r2=1.1489
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/lib/CryptoPP.cc?cvsroot=mldonkey&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/lib/CryptoPP.h?cvsroot=mldonkey&r1=1.8&r2=1.9

Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1488
retrieving revision 1.1489
diff -u -b -r1.1488 -r1.1489
--- distrib/ChangeLog   23 Oct 2010 18:22:29 -0000      1.1488
+++ distrib/ChangeLog   23 Oct 2010 18:23:38 -0000      1.1489
@@ -15,6 +15,7 @@
 =========
 
 2010/10/23
+7319: EDK: Fix CryptoPP on mips64 abi n32 (viric)
 7356: options: ensure that tmp file is removed (ygrek)
 7355: DC web ui: escape commands' arguments (ygrek)
 7354: DC: cleanup temporary files (ygrek)

Index: src/utils/lib/CryptoPP.cc
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/lib/CryptoPP.cc,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- src/utils/lib/CryptoPP.cc   7 Aug 2010 14:51:16 -0000       1.10
+++ src/utils/lib/CryptoPP.cc   23 Oct 2010 18:23:38 -0000      1.11
@@ -890,35 +890,6 @@
        return (unsigned int)value&1;
 }
 
-unsigned int BytePrecision(unsigned long value)
-{
-       unsigned int i;
-       for (i=sizeof(value); i; --i)
-               if (value >> (i-1)*8)
-                       break;
-
-       return i;
-}
-
-unsigned int BitPrecision(unsigned long value)
-{
-       if (!value)
-               return 0;
-
-       unsigned int l=0, h=8*sizeof(value);
-
-       while (h-l > 1)
-       {
-               unsigned int t = (l+h)/2;
-               if (value >> t)
-                       l = t;
-               else
-                       h = t;
-       }
-
-       return h;
-}
-
 unsigned long Crop(unsigned long value, unsigned int size)
 {
        if (size < 8*sizeof(value))
@@ -1880,7 +1851,10 @@
                #elif defined(__x86_64__)
                        __asm__("mulq %3" : "=d" (r.m_halfs.high), "=a" 
(r.m_halfs.low) : "a" (a), "rm" (b) : "cc");
                #elif defined(__mips64)
-                       __asm__("dmultu %2,%3" : "=h" (r.m_halfs.high), "=l" 
(r.m_halfs.low) : "r" (a), "r" (b));
+      //typedef unsigned int uint128_t __attribute__((mode(TI)));
+      __uint128_t tmp = (__uint128_t) a * b;
+      r.m_halfs.high = tmp >> 64;
+      r.m_halfs.low = tmp;
                #elif defined(_M_IX86)
                        // for testing
                        word64 t = (word64)a * b;

Index: src/utils/lib/CryptoPP.h
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/lib/CryptoPP.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- src/utils/lib/CryptoPP.h    7 Aug 2010 14:51:16 -0000       1.8
+++ src/utils/lib/CryptoPP.h    23 Oct 2010 18:23:38 -0000      1.9
@@ -1869,10 +1869,39 @@
 // #define GETBYTE(x, y) (((byte *)&(x))[y])
 
 CRYPTOPP_DLL unsigned int Parity(unsigned long);
-CRYPTOPP_DLL unsigned int BytePrecision(unsigned long);
-CRYPTOPP_DLL unsigned int BitPrecision(unsigned long);
 CRYPTOPP_DLL unsigned long Crop(unsigned long, unsigned int size);
 
+template <typename T>
+unsigned int BitPrecision(const T &value)
+{
+       if (!value)
+               return 0;
+
+       unsigned int l=0, h=8*sizeof(value);
+
+       while (h-l > 1)
+       {
+               unsigned int t = (l+h)/2;
+               if (value >> t)
+                       l = t;
+               else
+                       h = t;
+       }
+
+       return h;
+}
+
+template <typename T>
+unsigned int BytePrecision(const T &value)
+{
+       unsigned int i;
+       for (i=sizeof(value); i; --i)
+               if (value >> (i-1)*8)
+                       break;
+
+       return i;
+}
+
 inline unsigned int BitsToBytes(unsigned int bitCount)
 {
        return ((bitCount+7)/(8));



reply via email to

[Prev in Thread] Current Thread [Next in Thread]