guile-cvs
[Top][All Lists]
Advanced

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

guile/guile-core/libguile ChangeLog __scm.h num...


From: Dirk Herrmann
Subject: guile/guile-core/libguile ChangeLog __scm.h num...
Date: Thu, 18 Jan 2001 05:35:45 -0800

CVSROOT:        /cvs
Module name:    guile
Changes by:     Dirk Herrmann <address@hidden>  01/01/18 05:35:45

Modified files:
        guile-core/libguile: ChangeLog __scm.h numbers.h 

Log message:
        * Cleaned up some limits-definitions.

CVSWeb URLs:
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/ChangeLog.diff?r1=1.1235&r2=1.1236
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/__scm.h.diff?r1=1.62&r2=1.63
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/numbers.h.diff?r1=1.45&r2=1.46

Patches:
Index: guile/guile-core/libguile/ChangeLog
diff -u guile/guile-core/libguile/ChangeLog:1.1235 
guile/guile-core/libguile/ChangeLog:1.1236
--- guile/guile-core/libguile/ChangeLog:1.1235  Wed Jan 17 10:15:30 2001
+++ guile/guile-core/libguile/ChangeLog Thu Jan 18 05:35:44 2001
@@ -1,3 +1,18 @@
+2001-01-18  Dirk Herrmann  <address@hidden>
+
+       * __scm.h:  Added comment about architecture and compiler
+       properties that are required by guile.
+
+       (SCM_FIXNUM_BIT, SCM_MOST_POSITIVE_FIXNUM,
+       SCM_MOST_NEGATIVE_FIXNUM):  Moved to numbers.h.
+
+       (SCM_CHAR_BIT, SCM_LONG_BIT):  Moved here from numbers.h.
+
+       * numbers.h (SCM_CHAR_BIT, SCM_LONG_BIT):  Moved to __scm.h.
+
+       (SCM_FIXNUM_BIT, SCM_MOST_POSITIVE_FIXNUM,
+       SCM_MOST_NEGATIVE_FIXNUM):  Moved here from __scm.h.
+
 2001-01-17  Dirk Herrmann  <address@hidden>
 
        * __scm.h (SCM_FIXNUM_BIT):  Added.  The name is chosen in analogy
Index: guile/guile-core/libguile/__scm.h
diff -u guile/guile-core/libguile/__scm.h:1.62 
guile/guile-core/libguile/__scm.h:1.63
--- guile/guile-core/libguile/__scm.h:1.62      Wed Jan 17 10:15:30 2001
+++ guile/guile-core/libguile/__scm.h   Thu Jan 18 05:35:44 2001
@@ -203,37 +203,46 @@
 
 
 
-/* Define
+/* {Architecture and compiler properties}
  *
- * SCM_CHAR_CODE_LIMIT         == UCHAR_MAX + 1
- * SCM_MOST_POSITIVE_FIXNUM    (LONG_MAX>>2)
- * SCM_MOST_NEGATIVE_FIXNUM    == SCM_SRS((long)LONG_MIN, 2)
+ * Guile as of today can only work on systems which fulfill at least the
+ * following requirements:
+ * - long ints have at least 32 bits.
+ *   Guile's type system is based on this assumption.
+ * - long ints consist of at least four characters.
+ *   It is assumed that cells, i. e. pairs of long ints, are eight character
+ *   aligned, because three bits of a cell pointer are used for type data.
+ * - sizeof (void*) == sizeof (long int)
+ *   Pointers are stored in SCM objects, and sometimes SCM objects are passed
+ *   as void*.  Thus, there has to be a one-to-one correspondence.
+ * - numbers are encoded using two's complement.
+ *   The implementation of the bitwise scheme level operations is based on
+ *   this assumption.
+ * - ... add more
  */
 
 #ifdef HAVE_LIMITS_H
 # include <limits.h>
-# ifdef UCHAR_MAX
-#  define SCM_CHAR_CODE_LIMIT (UCHAR_MAX+1L)
-# else
-#  define SCM_CHAR_CODE_LIMIT 256L
-# endif /* def UCHAR_MAX */
-# define SCM_FIXNUM_BIT (LONG_BIT - 2)
-# define SCM_MOST_POSITIVE_FIXNUM (LONG_MAX>>2)
-# ifdef _UNICOS                        /* Stupid cray bug */
-#  define SCM_MOST_NEGATIVE_FIXNUM ((long)LONG_MIN/4)
-# else
-#  define SCM_MOST_NEGATIVE_FIXNUM SCM_SRS((long)LONG_MIN, 2)
-# endif                                /* UNICOS */
+#endif
+
+#ifdef CHAR_BIT
+# define SCM_CHAR_BIT CHAR_BIT
+#else
+# define SCM_CHAR_BIT 8
+#endif
+
+#ifdef LONG_BIT
+# define SCM_LONG_BIT LONG_BIT
 #else
+# define SCM_LONG_BIT (SCM_CHAR_BIT * sizeof (long) / sizeof (char))
+#endif
+
+#ifdef UCHAR_MAX
+# define SCM_CHAR_CODE_LIMIT (UCHAR_MAX + 1L)
+#else
 # define SCM_CHAR_CODE_LIMIT 256L
-# define SCM_FIXNUM_BIT 30
-# define SCM_MOST_POSITIVE_FIXNUM ((long)((unsigned long)~0L>>3))
-# if (0 != ~0)
-#  define SCM_MOST_NEGATIVE_FIXNUM (-SCM_MOST_POSITIVE_FIXNUM-1)
-# else
-#  define SCM_MOST_NEGATIVE_FIXNUM (-SCM_MOST_POSITIVE_FIXNUM)
-# endif /*  (0 != ~0) */
-#endif /* def HAVE_LIMITS_H */
+#endif
+
 
 
 #ifdef STDC_HEADERS
Index: guile/guile-core/libguile/numbers.h
diff -u guile/guile-core/libguile/numbers.h:1.45 
guile/guile-core/libguile/numbers.h:1.46
--- guile/guile-core/libguile/numbers.h:1.45    Thu Nov 23 05:54:49 2000
+++ guile/guile-core/libguile/numbers.h Thu Jan 18 05:35:45 2001
@@ -52,7 +52,6 @@
 
 
 
-
 /* Immediate Numbers 
  *
  * Inums are exact integer data that fits within an SCM word.
@@ -63,6 +62,11 @@
  * SCM_INUMP (SCM_CAR (x)) can give wrong answers.
  */
 
+#define SCM_FIXNUM_BIT (SCM_LONG_BIT - 2)
+#define SCM_MOST_POSITIVE_FIXNUM ((1L << (SCM_FIXNUM_BIT - 1)) - 1)
+#define SCM_MOST_NEGATIVE_FIXNUM (-SCM_MOST_POSITIVE_FIXNUM - 1)
+
+
 /* SCM_SRS is signed right shift */
 #if (-1 == (((-1) << 2) + 2) >> 2)
 # define SCM_SRS(x, y) ((x) >> (y))
@@ -111,15 +115,7 @@
 /* SCM_INTBUFLEN is the maximum number of characters neccessary for the
  * printed or scm_string representation of an exact immediate.
  */
-
-#ifndef SCM_CHAR_BIT
-# define SCM_CHAR_BIT 8
-#endif /* ndef SCM_CHAR_BIT */
-#ifndef SCM_LONG_BIT
-# define SCM_LONG_BIT (SCM_CHAR_BIT*sizeof(long)/sizeof(char))
-#endif /* ndef SCM_LONG_BIT */
-#define SCM_INTBUFLEN (5+SCM_LONG_BIT)
-
+#define SCM_INTBUFLEN (5 + SCM_LONG_BIT)
 
 
 



reply via email to

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