summaryrefslogtreecommitdiff
path: root/libguile/random.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2010-11-19 11:29:26 +0100
committerAndy Wingo <wingo@pobox.com>2010-11-19 15:22:43 +0100
commite25f37271acde5b9e3c34420ad9d0faa62b7503d (patch)
treeab77d62427c4c4fa717f3c62aa79765c7633d88e /libguile/random.c
parentd2aed81f7cb8b703b000962a1b9dddc8de91212e (diff)
downloadguile-e25f37271acde5b9e3c34420ad9d0faa62b7503d.tar.gz
fix a number of assuptions that a long could hold an inum
* libguile/bytevectors.c: * libguile/goops.c: * libguile/instructions.c: * libguile/numbers.c: * libguile/random.c: * libguile/read.c: * libguile/vm-i-scheme.c: Fix a number of assumptions that a long could hold an inum. This is not the case on platforms whose void* is larger than their long. * libguile/numbers.c (scm_i_inum2big): New helper, only implemented for sizeof(void*) == sizeof(long); produces a compile error on other platforms. Basically gmp doesn't have a nice interface for converting between mpz values and intmax_t.
Diffstat (limited to 'libguile/random.c')
-rw-r--r--libguile/random.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libguile/random.c b/libguile/random.c
index c0a3e046b..f487eb8d9 100644
--- a/libguile/random.c
+++ b/libguile/random.c
@@ -392,16 +392,16 @@ SCM_DEFINE (scm_random, "random", 1, 1, 0,
SCM_VALIDATE_RSTATE (2, state);
if (SCM_I_INUMP (n))
{
- unsigned long m = (unsigned long) SCM_I_INUM (n);
+ scm_t_bits m = (scm_t_bits) SCM_I_INUM (n);
SCM_ASSERT_RANGE (1, n, SCM_I_INUM (n) > 0);
-#if SCM_SIZEOF_UNSIGNED_LONG <= 4
+#if SCM_SIZEOF_UINTPTR_T <= 4
return scm_from_uint32 (scm_c_random (SCM_RSTATE (state),
(scm_t_uint32) m));
-#elif SCM_SIZEOF_UNSIGNED_LONG <= 8
+#elif SCM_SIZEOF_UINTPTR_T <= 8
return scm_from_uint64 (scm_c_random64 (SCM_RSTATE (state),
(scm_t_uint64) m));
#else
-#error "Cannot deal with this platform's unsigned long size"
+#error "Cannot deal with this platform's scm_t_bits size"
#endif
}
SCM_VALIDATE_NIM (1, n);