]> www.ginac.de Git - cln.git/commitdiff
Distinguish between cl_word_size and the ABI's pointer size.
authorBruno Haible <bruno@clisp.org>
Wed, 21 Jun 2000 23:11:54 +0000 (23:11 +0000)
committerBruno Haible <bruno@clisp.org>
Wed, 21 Jun 2000 23:11:54 +0000 (23:11 +0000)
ChangeLog
include/cl_object.h
include/cl_types.h
src/float/sfloat/cl_SF.h
src/integer/cl_I.h
src/integer/elem/cl_I_compare.cc
src/integer/elem/cl_I_equal.cc
src/integer/elem/cl_I_minus1.cc
src/integer/elem/cl_I_plus1.cc

index 0aeb75881c848946ebf02e2aeecf7194d2e0b973..3f72f40d2f8c1294f7a0165b265ed52da66806a7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2000-06-22  Bruno Haible  <haible@clisp.cons.org>
+
+        * include/cl_object.h: Rename cl_word_size to cl_pointer_size.
+        * include/cl_types.h (HAVE_FAST_LONGLONG): Also define on Irix6
+          with N32 ABI.
+          (cl_word_size): New macro.
+        * src/float/sfloat/cl_SF.h: Use cl_pointer_size instead of
+          cl_word_size.
+
 2000-06-05  Richard Kreckel  <kreckel@ginac.de>
 
         * doc/*, INSTALL: Mention that both shared and static library are
index 328c36cb54506c45d3116b3cd0cf118dbb2b018b..605ea262e054aec6974fae6cd1b407b6ec47f253 100644 (file)
@@ -62,9 +62,9 @@
 // Immediate data is a word, as wide as a pointer.
 typedef sintP  cl_sint;
 typedef uintP  cl_uint;  // This ought to be called `cl_word'.
-#define cl_word_size intPsize
-// NB: (cl_word_size==64) implies defined(HAVE_FAST_LONGLONG)
-#if (cl_word_size==64)
+#define cl_pointer_size intPsize
+// NB: (cl_pointer_size==64) implies defined(HAVE_FAST_LONGLONG)
+#if (cl_pointer_size==64)
   #define CL_WIDE_POINTERS
 #endif
 
@@ -90,12 +90,12 @@ inline cl_boolean cl_immediate_p (cl_uint word)
   #define cl_tag_len   3
 #endif
 #define cl_tag_shift   0
-#if (cl_word_size == 64)
+#if (cl_pointer_size == 64)
   #define cl_value_shift  32
 #else
   #define cl_value_shift  (cl_tag_len+cl_tag_shift)
 #endif
-#define cl_value_len   (cl_word_size - cl_value_shift)
+#define cl_value_len   (cl_pointer_size - cl_value_shift)
 #define cl_tag_mask    (((1UL << cl_tag_len) - 1) << cl_tag_shift)
 #define cl_value_mask  (((1UL << cl_value_len) - 1) << cl_value_shift)
 
@@ -108,7 +108,7 @@ inline cl_uint cl_tag (cl_uint word)
 // Return the value (unsigned) of a word.
 inline cl_uint cl_value (cl_uint word)
 {
-       // This assumes cl_value_shift + cl_value_len == cl_word_size.
+       // This assumes cl_value_shift + cl_value_len == cl_pointer_size.
        return word >> cl_value_shift;
 }
 
@@ -119,7 +119,7 @@ inline cl_uint cl_combine (cl_uint tag, cl_uint value)
 }
 inline cl_uint cl_combine (cl_uint tag, cl_sint value)
 {
-       // This assumes cl_value_shift + cl_value_len == cl_word_size.
+       // This assumes cl_value_shift + cl_value_len == cl_pointer_size.
        return (value << cl_value_shift) + (tag << cl_tag_shift);
 }
 // Keep the compiler happy.
index 5e402e78384c36f8ba2996f39d93771b73b5a435..aba536c9508d5889d501ca577edee157fb07c756 100644 (file)
@@ -48,7 +48,7 @@
     #undef HAVE_LONGLONG
    #endif
   #endif
-  #if defined(HAVE_LONGLONG) && (defined(__alpha__) || defined(__mips64__) || defined(__sparc64__))
+  #if defined(HAVE_LONGLONG) && (defined(__alpha__) || defined(__mips64__) || (defined(__mips__) && defined(_ABIN32)) || defined(__sparc64__))
     // 64 bit registers in hardware
     #define HAVE_FAST_LONGLONG
   #endif
   typedef long           sintP;
   typedef unsigned long  uintP;
 
+// Largest integer type which can be manipulated as efficiently as a pointer.
+// This is normally the same as the hardware register size.
+// Assumption: cl_word_size >= intPsize
+  #ifdef HAVE_FAST_LONGLONG
+    #define cl_word_size  64
+  #else
+    #define cl_word_size  32
+  #endif
+
 // Numbers in the heap are stored as "digit" sequences.
 // A digit is an unsigned int with intDsize bits.
 // intDsize should be 8 or 16 or 32 or 64.
index f871d56a6702407259896c1c0ed00096603f4202..07e6ef916fdd099fa649602caf5ac295cad5de40 100644 (file)
@@ -21,7 +21,7 @@
   #define SF_exp_high  (bit(SF_exp_len)-1)     // maximum exponent
   #define SF_exp_shift  (SF_mant_len+SF_mant_shift) // lowest exponent bit
   #define SF_mant_shift  SF_value_shift                    // lowest mantissa bit
-  #define SF_sign_shift  (cl_word_size - 1)
+  #define SF_sign_shift  (cl_pointer_size - 1)
 
 // Builds a float from the immediate word.
 inline cl_SF::cl_SF (struct cl_sfloat * null, cl_uint w)
@@ -71,7 +71,7 @@ inline uintL SF_uexp (const cl_SF& x)
 }
 inline cl_signean SF_sign (const cl_SF& x)
 {
-       return ((cl_sint)x.word << (cl_word_size-1 - SF_sign_shift)) >> (cl_word_size-1);
+       return ((cl_sint)x.word << (cl_pointer_size-1 - SF_sign_shift)) >> (cl_pointer_size-1);
 }
 inline uintL SF_mant (const cl_SF& x)
 {
index 9349fa68be18ca938d83468f082874a6bc1cca49..44df5eb838440c0da3c24540c764b2f0051fa5dc 100644 (file)
@@ -89,7 +89,7 @@ inline cl_boolean bignump (const cl_I& x)
 inline cl_boolean minusp (const cl_I& x)
 {
        if (fixnump(x))
-               // This assumes cl_value_shift + cl_value_len == cl_word_size.
+               // This assumes cl_value_shift + cl_value_len == cl_pointer_size.
                return (cl_boolean)((cl_sint) x.word < 0);
        else
                return (cl_boolean)((sintD)mspref(arrayMSDptr(TheBignum(x)->data,TheBignum(x)->length),0) < 0);
@@ -116,7 +116,7 @@ inline cl_boolean eq (const cl_I& x, sint32 y)
 // < ergebnis: der Wert des Fixnum als 32-Bit-Zahl.
 inline uint32 FN_to_UL (const cl_I& x)
 {
-       // This assumes cl_value_shift + cl_value_len == cl_word_size.
+       // This assumes cl_value_shift + cl_value_len == cl_pointer_size.
        return (cl_uint)(x.word) >> cl_value_shift;
 }
 
@@ -126,7 +126,7 @@ inline uint32 FN_to_UL (const cl_I& x)
 // < ergebnis: der Wert des Fixnum als 32-Bit-Zahl.
 inline sint32 FN_to_L (const cl_I& x)
 {
-       // This assumes cl_value_shift + cl_value_len == cl_word_size.
+       // This assumes cl_value_shift + cl_value_len == cl_pointer_size.
        return (cl_sint)(x.word) >> cl_value_shift;
 }
 
@@ -146,7 +146,7 @@ inline sint32 FN_to_L (const cl_I& x)
 // < ergebnis: der Wert des Fixnum als 64-Bit-Zahl.
 inline sint64 FN_to_Q (const cl_I& x)
 {
-       // This assumes cl_value_shift + cl_value_len == cl_word_size.
+       // This assumes cl_value_shift + cl_value_len == cl_pointer_size.
        return (cl_sint)(x.word) >> cl_value_shift;
 }
 
@@ -362,7 +362,7 @@ inline uint64 pFN_maxlength_digits_at (const uintD* ptr)
 
 inline sintD FN_MSD (cl_uint word)
 {
-       // This assumes cl_value_shift + cl_value_len == cl_word_size.
+       // This assumes cl_value_shift + cl_value_len == cl_pointer_size.
        return (cl_sint)word >> (cl_value_shift + (FN_maxlength-1)*intDsize);
 }
 
@@ -629,7 +629,7 @@ inline cl_boolean bignump (const cl_FN& x)
 
 inline cl_boolean minusp (const cl_FN& x)
 {
-       // This assumes cl_value_shift + cl_value_len == cl_word_size.
+       // This assumes cl_value_shift + cl_value_len == cl_pointer_size.
        return (cl_boolean)((cl_sint) x.word < 0);
 }
 
index 5e6e42e1f5a6dfc8ea7d29c5eb6d42ab17fe01aa..f9b8adb9e1ce2e4a8c520c6eef207fd84066bd68 100644 (file)
@@ -38,7 +38,7 @@ cl_signean cl_compare (const cl_I& x, const cl_I& y)
         // x Fixnum
         if (fixnump(y))
           // x Fixnum, y Fixnum
-          { // This assumes cl_value_shift + cl_value_len == cl_word_size.
+          { // This assumes cl_value_shift + cl_value_len == cl_pointer_size.
             if ((cl_sint)x.word == (cl_sint)y.word) return signean_null;
             else if ((cl_sint)x.word > (cl_sint)y.word) return signean_plus;
             else return signean_minus;
index 4bcc646ad970b822a96c6747089b51032541bd3d..3476f5fb1a4fe5fc3268521628974b5f7cf3aa18 100644 (file)
@@ -27,7 +27,7 @@ cl_boolean cl_equal (const cl_I& x, const cl_I& y)
         // x Fixnum
         if (fixnump(y))
           // x Fixnum, y Fixnum
-          { // This assumes cl_value_shift + cl_value_len == cl_word_size.
+          { // This assumes cl_value_shift + cl_value_len == cl_pointer_size.
             return (cl_boolean) ((cl_sint)x.word == (cl_sint)y.word);
           }
           else
index 38aa6606f80ac3f47441bbd4227a65103f73e514..e7fd54a887ff960102918d62b4ee0ca261ecd608 100644 (file)
@@ -18,7 +18,7 @@ const cl_I minus1 (const cl_I& x)
          { // x ist Fixnum
            if (x.word != cl_combine(cl_FN_tag,bit(cl_value_len-1)))
                // bleibt Fixnum: direkt 1 subtrahieren
-               // This assumes cl_value_shift + cl_value_len == cl_word_size.
+               // This assumes cl_value_shift + cl_value_len == cl_pointer_size.
                { return cl_I_from_word(x.word - cl_combine(0,1)); }
           }
         // die sichere Methode
index 58c90d7267367e77bcf8b50e7e9f6c1713017a42..bc73cfccc1c2df4318368804ae03e4a292d4bb63 100644 (file)
@@ -18,7 +18,7 @@ const cl_I plus1 (const cl_I& x)
          { // x ist Fixnum
            if (x.word != cl_combine(cl_FN_tag,bit(cl_value_len-1)-1))
                // bleibt Fixnum: direkt 1 addieren
-               // This assumes cl_value_shift + cl_value_len == cl_word_size.
+               // This assumes cl_value_shift + cl_value_len == cl_pointer_size.
                { return cl_I_from_word(x.word + cl_combine(0,1)); }
           }
         // die sichere Methode