diff options
author | Dirk Herrmann <dirk@dirk-herrmanns-seiten.de> | 2000-03-20 14:00:27 +0000 |
---|---|---|
committer | Dirk Herrmann <dirk@dirk-herrmanns-seiten.de> | 2000-03-20 14:00:27 +0000 |
commit | 7a710745b4ddbdc65889bfdfbd35d076a1bb0e1e (patch) | |
tree | 32c68a2ca864fed55753f4a862192384ed9a1442 | |
parent | 1ef20c801b1c6eb6c3ce2deb011e948deaf0e1a7 (diff) | |
download | guile-7a710745b4ddbdc65889bfdfbd35d076a1bb0e1e.tar.gz |
Fix a couple of SCM_PACK / SCM_UNPACK uncleanlynesses.
-rw-r--r-- | libguile/ChangeLog | 8 | ||||
-rw-r--r-- | libguile/numbers.h | 20 | ||||
-rw-r--r-- | libguile/tags.h | 8 |
3 files changed, 22 insertions, 14 deletions
diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 05f316ae7..44f1972f9 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -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. diff --git a/libguile/numbers.h b/libguile/numbers.h index da4b7a26c..e905ae7e9 100644 --- a/libguile/numbers.h +++ b/libguile/numbers.h @@ -64,16 +64,16 @@ * 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 @@ -185,8 +185,8 @@ #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) \ @@ -239,7 +239,7 @@ # 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) \ @@ -252,12 +252,12 @@ : 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, \ diff --git a/libguile/tags.h b/libguile/tags.h index af0d1d578..92891c032 100644 --- a/libguile/tags.h +++ b/libguile/tags.h @@ -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 */ |