diff options
author | Andy Wingo <wingo@pobox.com> | 2011-10-24 17:58:22 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2011-10-24 18:54:04 +0200 |
commit | 21041372ed4a3c837f6d16149648508d49b4b2e2 (patch) | |
tree | 77121f605195cc7effb3874c6df583bf9df5dc55 /libguile/numbers.c | |
parent | dc7da0be90d6033d512f9772894179970af678e7 (diff) | |
download | guile-21041372ed4a3c837f6d16149648508d49b4b2e2.tar.gz |
add SCM_{PACK,UNPACK}_POINTER
* libguile/tags.h (SCM_UNPACK_POINTER, SCM_PACK_POINTER): New macros.
The old SCM2PTR and PTR2SCM were defined in such a way that
round-tripping through a pointer could lose precision, even in the
case in which you weren't interested in actually dereferencing the
pointer, it was simply that you needed to plumb a SCM through APIs
that take pointers. These new macros are more like SCM_PACK and
SCM_UNPACK, but for pointer types. The bit representation of the
pointer should be the same as the scm_t_bits representation.
* libguile/gc.h (PTR2SCM, SCM2PTR): Remove support for (old) UNICOS
pointers. We are going to try tagging the SCM object itself in the
future, and I don't think that keeping this support is worth its
cost. It probably doesn't work anyway.
* libguile/backtrace.c:
* libguile/bytevectors.c:
* libguile/continuations.c:
* libguile/fluids.c:
* libguile/foreign.c:
* libguile/gc.h:
* libguile/guardians.c:
* libguile/hashtab.c:
* libguile/load.c:
* libguile/numbers.c:
* libguile/ports.c:
* libguile/smob.c:
* libguile/strings.c:
* libguile/symbols.c:
* libguile/vm.c:
* libguile/weak-set.c:
* libguile/weak-table.c:
* libguile/weak-vector.c: Update many sites to use the new macros.
Diffstat (limited to 'libguile/numbers.c')
-rw-r--r-- | libguile/numbers.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libguile/numbers.c b/libguile/numbers.c index 19673b84a..96e176590 100644 --- a/libguile/numbers.c +++ b/libguile/numbers.c @@ -178,7 +178,7 @@ finalize_bignum (GC_PTR ptr, GC_PTR data) { SCM bignum; - bignum = PTR2SCM (ptr); + bignum = SCM_PACK_POINTER (ptr); mpz_clear (SCM_I_BIG_MPZ (bignum)); } @@ -8655,7 +8655,7 @@ scm_c_make_rectangular (double re, double im) { SCM z; - z = PTR2SCM (scm_gc_malloc_pointerless (sizeof (scm_t_complex), + z = SCM_PACK_POINTER (scm_gc_malloc_pointerless (sizeof (scm_t_complex), "complex")); SCM_SET_CELL_TYPE (z, scm_tc16_complex); SCM_COMPLEX_REAL (z) = re; @@ -9307,7 +9307,7 @@ scm_from_double (double val) { SCM z; - z = PTR2SCM (scm_gc_malloc_pointerless (sizeof (scm_t_double), "real")); + z = SCM_PACK_POINTER (scm_gc_malloc_pointerless (sizeof (scm_t_double), "real")); SCM_SET_CELL_TYPE (z, scm_tc16_real); SCM_REAL_VALUE (z) = val; |