]> www.ginac.de Git - cln.git/commitdiff
* include/cln/object.h (cl_combine): define additional signatures, if
authorRichard Kreckel <kreckel@ginac.de>
Wed, 1 Nov 2000 18:31:57 +0000 (18:31 +0000)
committerRichard Kreckel <kreckel@ginac.de>
Wed, 1 Nov 2000 18:31:57 +0000 (18:31 +0000)
          HAVE_LONGLONG is defined, in order to keep the compiler happy.
        * src/base/cl_macros.h: include "cln/types.h", since we need HAVE_DD...
        * src/base/cl_macros.h (bit): ...for this macro...
        * src/base/cl_macros.h (minus_bit): ...and this one.
        * src/base/cl_low.h: include "cln/types.h", since we need HAVE_DD...
        * src/base/cl_low.h (logcount_64): ...for this macro.
        * src/base/random/cl_UL_random.cc (random32): if HAVE_DD a is an ULL.
        * src/integer/gcd/cl_I_gcd_aux2.cc (floorDD): fixed algorithmic bug
          that turned up when intDsize==32 and cl_word_size==64.
        * src/float/dfloat/elem/cl_DF_div.cc (operator/): fixed a missing cast
          to uint64 that turned up when intDsize==32 and cl_word_size==64.

ChangeLog
src/base/cl_low.h
src/base/cl_macros.h
src/base/random/cl_UL_random.cc
src/float/dfloat/elem/cl_DF_div.cc
src/integer/gcd/cl_I_gcd_aux2.cc

index 3121514fd8fc4ae3c746e3b641d751539004278f..4284ffb6c0b8cca505464a91e1260b34c8e791e5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2000-11-01  Richard Kreckel  <kreckel@ginac.de>
+
+        * include/cln/object.h (cl_combine): define additional signatures, if
+          HAVE_LONGLONG is defined, in order to keep the compiler happy.
+        * src/base/cl_macros.h: include "cln/types.h", since we need HAVE_DD...
+        * src/base/cl_macros.h (bit): ...for this macro...
+        * src/base/cl_macros.h (minus_bit): ...and this one.
+        * src/base/cl_low.h: include "cln/types.h", since we need HAVE_DD...
+        * src/base/cl_low.h (logcount_64): ...for this macro.
+        * src/base/random/cl_UL_random.cc (random32): if HAVE_DD a is an ULL.
+        * src/integer/gcd/cl_I_gcd_aux2.cc (floorDD): fixed algorithmic bug
+          that turned up when intDsize==32 and cl_word_size==64.
+        * src/float/dfloat/elem/cl_DF_div.cc (operator/): fixed a missing cast
+          to uint64 that turned up when intDsize==32 and cl_word_size==64.
+
 2000-10-29  Richard Kreckel  <kreckel@ginac.de>
 
         * src/real/input/cl_R_read.cc, src/complex/input/cl_N_read.cc:
index 542078d368fa63882bfbad87d901cfad3e65afa0..ccfe1f082f24d51b9ae743e178416fac8b9ec3ba 100644 (file)
@@ -3,6 +3,8 @@
 #ifndef _CL_LOW_H
 #define _CL_LOW_H
 
+#include "cln/types.h"
+
 namespace cln {
 
 // Determines the sign of a 16-bit number.
@@ -1295,6 +1297,23 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2)
       /* x32 besteht aus 1 16-Bit-Zähler (0,...,32).          */\
     )
   // Bits von x64 zählen: (Input x64, Output x64)
+#if HAVE_DD
+  #define logcount_64()  \
+    ( /* x64 besteht aus 64 1-Bit-Zählern (0,1).                             */\
+      x64 = (x64 & 0x5555555555555555ULL) + ((x64 & 0xAAAAAAAAAAAAAAAAULL) >> 1),\
+      /* x64 besteht aus 32 2-Bit-Zählern (0,1,2).                           */\
+      x64 = (x64 & 0x3333333333333333ULL) + ((x64 & 0xCCCCCCCCCCCCCCCCULL) >> 2),\
+      /* x64 besteht aus 16 4-Bit-Zählern (0,1,2,3,4).                       */\
+      x64 = (uint32)(x64 + (x64 >> 32)),                                      \
+      /* x64 besteht aus 8 4-Bit-Zählern (0,...,8).                          */\
+      x64 = (x64 & 0x0F0F0F0FUL) + ((x64 & 0xF0F0F0F0UL) >> 4),                       \
+      /* x64 besteht aus 4 8-Bit-Zählern (0,...,16).                         */\
+      x64 = (x64 & 0x00FF00FFU) + ((x64 & 0xFF00FF00U) >> 8),                 \
+      /* x64 besteht aus 2 16-Bit-Zählern (0,...,32).                        */\
+      x64 = (x64 & 0x0000FFFFU) + (x64 >> 16)                                 \
+      /* x64 besteht aus 1 16-Bit-Zähler (0,...,64).                         */\
+    )
+#else
   #define logcount_64()  \
     ( /* x64 besteht aus 64 1-Bit-Zählern (0,1).                             */\
       x64 = (x64 & 0x5555555555555555UL) + ((x64 & 0xAAAAAAAAAAAAAAAAUL) >> 1),\
@@ -1310,6 +1329,7 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2)
       x64 = (x64 & 0x0000FFFFU) + (x64 >> 16)                                 \
       /* x64 besteht aus 1 16-Bit-Zähler (0,...,64).                         */\
     )
+#endif
 
 }  // namespace cln
 
index bf28b2a0c5a4fe4707efa0eeabf3917f8789d1b1..387247c7c1e3f38f4f7f01cb922404fda9b43817 100644 (file)
@@ -3,6 +3,8 @@
 #ifndef _CL_MACROS_H
 #define _CL_MACROS_H
 
+#include "cln/types.h"
+
 // Concatenation of macroexpanded tokens.
 // Example:
 //   #undef x
@@ -108,8 +110,12 @@ namespace cln {
   #undef NULL
   #define NULL  0
 
-// Bit number n (0<=n<32)
+// Bit number n (0<=n<32 or 0<=n<64)
+#if HAVE_DD
+  #define bit(n)  (1LL<<(n))
+#else
   #define bit(n)  (1L<<(n))
+#endif
 // Bit number n (0<n<=32) mod 2^32
   #define bitm(n)  (2L<<((n)-1))
 // Test bit n in x, n constant, x a cl_uint:
@@ -127,8 +133,12 @@ namespace cln {
         )
     #endif
   #endif
-// minus bit number n (0<=n<32)
+// minus bit number n (0<=n<32 or 0<=n<64)
+#if HAVE_DD
+  #define minus_bit(n)  (-1LL<<(n))
+#else
   #define minus_bit(n)  (-1L<<(n))
+#endif
 // minus bit number n (0<n<=32) mod 2^32
   #define minus_bitm(n)  (-2L<<((n)-1))
 
index 782ab4876b9467700d0cd8ca5e21e0f50965508e..d03ab82fcb1346cfb4c315aea91320f9aa57d523 100644 (file)
@@ -23,7 +23,11 @@ uint32 random32 (random_state& randomstate)
 #ifdef HAVE_FAST_LONGLONG
        // Multiplikator a=6364136223846793005 = 0x5851F42D4C957F2D :
        var uint64 seed = highlow64(randomstate.seed.hi,randomstate.seed.lo);
+#if HAVE_DD
+       var const uint64 a = 0x5851F42D4C957F2DULL;
+#else
        var const uint64 a = 0x5851F42D4C957F2DUL;
+#endif
        var uint64 newseed;
        // multiplizieren, brauche nur letzte 64 Bit:
        mulu64(seed,a, , newseed =);
index fa5ca78b2c26b1aae7b64df52d7b118870d98e0e..d5e954193c63a6b8e9044e1ea2d5b0ddf0a844c9 100644 (file)
@@ -145,7 +145,7 @@ const cl_DF operator/ (const cl_DF& x1, const cl_DF& x2)
        // q = 2^32*manthi+mantlo.
        #if (cl_word_size==64)
        #if (intDsize<=32)
-       mantx = (manthi<<32) | (uint64)mantlo;
+       mantx = ((uint64)manthi<<32) | (uint64)mantlo;
        #endif
        if (mantx >= bit(DF_mant_len+2))
          // Quotient >=2^54 -> 2 Bits wegrunden
index 0b8bf94bcc4af6416ee10ca31d23d869b88579e1..507220d9836993d8fc4c5640dfa4b579ceca713f 100644 (file)
@@ -47,7 +47,7 @@ static uintD floorDD (uintDD x, uintDD y)
                if (y_shifted == 0)
                        q = highD(x) >> shift;
                else
-                       divuD(x,y_shifted, q =, );
+                       divuD(highD(x) >> shift, y_shifted, q =, );
        }
        // May need to increment q at most twice.
        {