diff --git a/ChangeLog b/ChangeLog index 3121514..4284ffb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2000-11-01 Richard Kreckel + + * 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 * src/real/input/cl_R_read.cc, src/complex/input/cl_N_read.cc: diff --git a/src/base/cl_low.h b/src/base/cl_low.h index 542078d..ccfe1f0 100644 --- a/src/base/cl_low.h +++ b/src/base/cl_low.h @@ -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 diff --git a/src/base/cl_macros.h b/src/base/cl_macros.h index bf28b2a..387247c 100644 --- a/src/base/cl_macros.h +++ b/src/base/cl_macros.h @@ -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= bit(DF_mant_len+2)) // Quotient >=2^54 -> 2 Bits wegrunden diff --git a/src/integer/gcd/cl_I_gcd_aux2.cc b/src/integer/gcd/cl_I_gcd_aux2.cc index 0b8bf94..507220d 100644 --- a/src/integer/gcd/cl_I_gcd_aux2.cc +++ b/src/integer/gcd/cl_I_gcd_aux2.cc @@ -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. {