From f2961ccd8fb398f26e69d510bbbbcf1bff706ff7 Mon Sep 17 00:00:00 2001 From: Dirk Herrmann Date: Mon, 20 Mar 2000 18:14:07 +0000 Subject: [PATCH] A couple of typing problems (at leat partially) resolved. --- libguile/ChangeLog | 12 ++++++++++++ libguile/numbers.c | 6 +++++- libguile/numbers.h | 4 ++-- libguile/ramap.c | 9 +++++++-- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 0a9ecff22..f29a17e93 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,15 @@ +2000-03-20 Dirk Herrmann + + * numbers.h (SCM_MAKINUM): The parameter to SCM_MAKINUM should + already be a C value. No need to unpack it. + + * numbers.h (scm_long_long2num): Cast the parameter to scm_bits_t + if we know it fits into an inum. + + * ramap.c (ramap_rp): An scm_tc7_[ui]vect object does point to a + field of long values. In contrast, SCM_VELTS accesses a field of + SCM values. + 2000-03-20 Mikael Djurfeldt * gc.c (scm_gc_stats): Inserted explanation of local_scm_mtrigger diff --git a/libguile/numbers.c b/libguile/numbers.c index 307677afc..0ab8d9fb3 100644 --- a/libguile/numbers.c +++ b/libguile/numbers.c @@ -4422,7 +4422,11 @@ scm_long_long2num (long_long sl) return scm_makdbl ((double) sl, 0.0); #endif } - return SCM_MAKINUM (sl); + else + { + /* we know that sl fits into an inum */ + return SCM_MAKINUM ((scm_bits_t) sl); + } } #endif diff --git a/libguile/numbers.h b/libguile/numbers.h index e905ae7e9..244c013e9 100644 --- a/libguile/numbers.h +++ b/libguile/numbers.h @@ -71,9 +71,9 @@ /* shifts of more than one are done by a library call, single shifts are * performed in registers */ -# define SCM_MAKINUM(x) (SCM_PACK (((SCM_UNPACK (x) << 1) << 1) + 2L)) +# define SCM_MAKINUM(x) (SCM_PACK ((((x) << 1) << 1) + 2L)) #else -# define SCM_MAKINUM(x) (SCM_PACK ((SCM_UNPACK (x) << 2) + 2L)) +# define SCM_MAKINUM(x) (SCM_PACK (((x) << 2) + 2L)) #endif /* def __TURBOC__ */ diff --git a/libguile/ramap.c b/libguile/ramap.c index 8ef9eedde..8ab2bde4c 100644 --- a/libguile/ramap.c +++ b/libguile/ramap.c @@ -1321,8 +1321,13 @@ ramap_rp (SCM ra0,SCM proc,SCM ras) for (; n-- > 0; i0 += inc0, i1 += inc1, i2 += inc2) if (SCM_BITVEC_REF (ra0, i0)) { - if (SCM_FALSEP (SCM_SUBRF (proc) (SCM_MAKINUM (SCM_VELTS (ra1)[i1]), - SCM_MAKINUM (SCM_VELTS (ra2)[i2])))) + /* DIRK:FIXME:: There should be a way to access the elements + of a cell as raw data. Further: How can we be sure that + the values fit into an inum? + */ + SCM n1 = SCM_MAKINUM (((long *) SCM2PTR (SCM_CDR (ra1)))[i1]); + SCM n2 = SCM_MAKINUM (((long *) SCM2PTR (SCM_CDR (ra2)))[i2]); + if (SCM_FALSEP (SCM_SUBRF (proc) (n1, n2))); SCM_BITVEC_CLR (ra0, i0); } break;