~ chicken-core (chicken-5) cea57d12929acdb014df4ad34354aa6666529100
commit cea57d12929acdb014df4ad34354aa6666529100
Author: felix <felix@call-with-current-continuation.org>
AuthorDate: Sat Nov 4 13:11:06 2017 +0100
Commit: felix <felix@call-with-current-continuation.org>
CommitDate: Sat Nov 4 13:11:06 2017 +0100
random_bignum: use correct word type (spotted by sjamaan)
diff --git a/runtime.c b/runtime.c
index ffb526b4..9d312478 100644
--- a/runtime.c
+++ b/runtime.c
@@ -12662,14 +12662,14 @@ C_s_a_u_i_random_int(C_word **ptr, C_word n, C_word rn)
int len = integer_length_abs(rn);
C_word size = C_fix(C_BIGNUM_BITS_TO_DIGITS(len));
C_word result = C_allocate_scratch_bignum(ptr, size, C_SCHEME_FALSE, C_SCHEME_FALSE);
- C_u32 *p, mask;
+ C_uword *p, mask;
start = C_bignum_digits(result);
end = start + C_bignum_size(result);
- for(p = (C_u32 *)start; p < ((C_u32*)end - 1); ++p) {
+ for(p = start; p < (end - 1); ++p) {
*p = random_word();
- len -= sizeof(C_u32);
+ len -= sizeof(C_uword);
}
*end = random_word() >> len; /* XXX is this right? uniform? */
Trap