Fix a couple of SCM_PACK / SCM_UNPACK uncleanlynesses.
authorDirk Herrmann <dirk@dirk-herrmanns-seiten.de>
Mon, 20 Mar 2000 14:00:27 +0000 (14:00 +0000)
committerDirk Herrmann <dirk@dirk-herrmanns-seiten.de>
Mon, 20 Mar 2000 14:00:27 +0000 (14:00 +0000)
libguile/ChangeLog
libguile/numbers.h
libguile/tags.h

index 05f316a..44f1972 100644 (file)
@@ -1,3 +1,11 @@
+2000-03-20  Dirk Herrmann  <D.Herrmann@tu-bs.de>
+
+       * tags.h (SCM2PTR, PTR2SCM):  Use SCM_PACK / SCM_UNPACK correctly.
+
+       * numbers.h (SCM_INUMP, SCM_MAKINUM, SCM_INUM0, SCM_COMPLEX_REAL,
+       SCM_COMPLEX_IMAG, SCM_NUMP, SCM_BDIGITS):  Use SCM_PACK /
+       SCM_UNPACK / SCM2PTR correctly.
+
 2000-03-20  Mikael Djurfeldt  <mdj@mdj.nada.kth.se>
 
        * gc.c (adjust_gc_trigger): Improved documentation.
index da4b7a2..e905ae7 100644 (file)
  * SCM_INUMP (SCM_CAR (x)) can give wrong answers.
  */
 
-#define SCM_INUMP(x)   (2 & (int)(x))
-#define SCM_NINUMP(x)  (!SCM_INUMP(x))
+#define SCM_INUMP(x)   (2 & SCM_UNPACK (x))
+#define SCM_NINUMP(x)  (!SCM_INUMP (x))
 
 #ifdef __TURBOC__
 /* shifts of more than one are done by a library call, single shifts are
  * performed in registers
  */
-# define SCM_MAKINUM(x) ((SCM) (((SCM_UNPACK(x)<<1)<<1)+2L))
+# define SCM_MAKINUM(x) (SCM_PACK (((SCM_UNPACK (x) << 1) << 1) + 2L))
 #else
-# define SCM_MAKINUM(x) ((SCM)((SCM_UNPACK(x)<<2)+2L))
+# define SCM_MAKINUM(x) (SCM_PACK ((SCM_UNPACK (x) << 2) + 2L))
 #endif /* def __TURBOC__ */
 
 
@@ -98,7 +98,7 @@
 
 /* A name for 0.
  */
-#define SCM_INUM0 ((SCM) 2)
+#define SCM_INUM0 (SCM_PACK (2))
 
 
 /* SCM_MAXEXP is the maximum double precision expontent
 #define SCM_CPLXP(x) SCM_COMPLEXP(x) /* Deprecated */
 
 #define SCM_REAL_VALUE(x) (((scm_double_t *) SCM2PTR (x))->real)
-#define SCM_COMPLEX_REAL(x) (((scm_complex_t *) SCM_CDR (x))->real)
-#define SCM_COMPLEX_IMAG(x) (((scm_complex_t *) SCM_CDR (x))->imag)
+#define SCM_COMPLEX_REAL(x) (((scm_complex_t *) SCM2PTR (SCM_CDR (x)))->real)
+#define SCM_COMPLEX_IMAG(x) (((scm_complex_t *) SCM2PTR (SCM_CDR (x)))->imag)
 #define SCM_REAL(x) \
  (SCM_SLOPPY_REALP (x) \
   ? SCM_REAL_VALUE (x) \
 # define SCM_NO_BIGDIG
 #endif /* ndef SCM_BIGDIG */
 
-#define SCM_NUMBERP(x) (SCM_INUMP(x) || (SCM_NIMP(x) && SCM_NUMP(x)))
+#define SCM_NUMBERP(x) (SCM_INUMP(x) || SCM_NUMP(x))
 #ifdef SCM_BIGDIG
 #define SCM_NUM2DBL(x) (SCM_INUMP (x) \
                        ? (double) SCM_INUM (x) \
                        : SCM_REALPART (x))
 #endif
 #define SCM_NUMP(x) \
-  (SCM_NIMP(x) && (0xfcff & (int) SCM_CAR(x)) == scm_tc7_smob)
+  (SCM_NIMP(x) && (0xfcff & SCM_UNPACK (SCM_CAR(x))) == scm_tc7_smob)
 #define SCM_BIGP(x) SCM_SMOB_PREDICATE (scm_tc16_big, x)
 #define SCM_BIGSIGNFLAG 0x10000L
 #define SCM_BIGSIZEFIELD 17
 #define SCM_BIGSIGN(x) (SCM_UNPACK_CAR (x) & SCM_BIGSIGNFLAG)
-#define SCM_BDIGITS(x) ((SCM_BIGDIG *) (SCM_CDR (x)))
+#define SCM_BDIGITS(x) ((SCM_BIGDIG *) SCM2PTR (SCM_CDR (x)))
 #define SCM_NUMDIGS(x) ((scm_sizet) (SCM_UNPACK_CAR (x) >> SCM_BIGSIZEFIELD))
 #define SCM_SETNUMDIGS(x, v, sign) \
   SCM_SETCAR (x, \
index af0d1d5..92891c0 100644 (file)
@@ -85,12 +85,12 @@ typedef void * SCM;
  * to scm_vector elts, functions, &c are not munged.
  */
 #ifdef _UNICOS
-# define SCM2PTR(x) ((int) (x) >> 3)
-# define PTR2SCM(x) (((SCM) (x)) << 3)
+# define SCM2PTR(x) ((void *) (SCM_UNPACK (x) >> 3))
+# define PTR2SCM(x) (SCM_PACK (((scm_bits_t) (x)) << 3))
 # define SCM_POINTERS_MUNGED
 #else
-# define SCM2PTR(x) (x)
-# define PTR2SCM(x) ((SCM) (x))
+# define SCM2PTR(x) ((void *) (SCM_UNPACK (x)))
+# define PTR2SCM(x) (SCM_PACK ((scm_bits_t) (x)))
 #endif /* def _UNICOS */
 
 \f