fixed uint/ulong pointer ref bug (and added appropriate tests).

This commit is contained in:
Abdulaziz Ghuloum
2008-09-14 00:38:59 -07:00
parent 58d937c520
commit 9f2d7484ab
7 changed files with 55 additions and 150 deletions
+3 -3
View File
@@ -174,9 +174,9 @@ s_to_number(signed long n, ikpcb* pcb) {
static ikptr
u_to_number(unsigned long n, ikpcb* pcb) {
ikptr fx = fix(n);
if (unfix(fx) == n) {
return fx;
unsigned long mxn = ((unsigned long)-1)>>(fx_shift+1);
if (n <= mxn) {
return fix(n);
}
ikptr bn = ik_safe_alloc(pcb, align(wordsize+disp_bignum_data));
ref(bn, 0) = (ikptr)(bignum_tag | (1 << bignum_length_shift));