Browse Source

* 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.
master
Richard Kreckel 24 years ago
parent
commit
2f48af8059
  1. 15
      ChangeLog
  2. 20
      src/base/cl_low.h
  3. 14
      src/base/cl_macros.h
  4. 4
      src/base/random/cl_UL_random.cc
  5. 2
      src/float/dfloat/elem/cl_DF_div.cc
  6. 2
      src/integer/gcd/cl_I_gcd_aux2.cc

15
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:

20
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

14
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<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))

4
src/base/random/cl_UL_random.cc

@ -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 =);

2
src/float/dfloat/elem/cl_DF_div.cc

@ -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

2
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.
{
Loading…
Cancel
Save