~ chicken-core (chicken-5) ec5ebfca528c81b5550e24b7bef69b0701aa1032


commit ec5ebfca528c81b5550e24b7bef69b0701aa1032
Author:     Peter Bex <peter@more-magic.net>
AuthorDate: Sat May 23 15:04:40 2015 +0200
Commit:     Peter Bex <peter@more-magic.net>
CommitDate: Sun May 31 14:55:25 2015 +0200

    Fix C_long_to_num and C_unsigned_long_to_num so it doesn't attempt to allocate bignums of size 2

diff --git a/chicken.h b/chicken.h
index 94363b00..f268077f 100644
--- a/chicken.h
+++ b/chicken.h
@@ -2643,13 +2643,20 @@ C_inline C_word C_uint64_to_num(C_word **ptr, C_u64 n)
 
 C_inline C_word C_long_to_num(C_word **ptr, C_long n)
 {
-  return C_int64_to_num(ptr, (C_s64)n);
+  if(C_fitsinfixnump(n)) {
+    return C_fix(n);
+  } else {
+    return C_bignum1(ptr, n < 0, labs(n));
+  }
 }
 
-
 C_inline C_word C_unsigned_long_to_num(C_word **ptr, C_ulong n)
 {
-  return C_uint64_to_num(ptr, (C_u64)n);
+  if(C_ufitsinfixnump(n)) {
+    return C_fix(n);
+  } else {
+    return C_bignum1(ptr, 0, n);
+  }
 }
 
 
Trap