on master help sign in
Untabify
commitea21a05baea87a9566669f4427d2e8965aa8ba3e authorJorge Acereda <jacereda@gmail.com> dateSun 1 Apr 2018, 10:48 (9 years ago) parent549e40f
1 file changed+12−12
rts/idris_gmp.c+12−12
rts/idris_gmp.c+12−12
@@ -74,9 +74,9 @@ static BigInt * getbig(VM * vm, VAL x) {
7474 } else {
7575 switch(GETTY(x)) {
7676 case CT_FWD:
77− return getbig(vm, ((Fwd*)x)->fwd);
77+ return getbig(vm, ((Fwd*)x)->fwd);
7878 default:
79− return (BigInt*)x;
79+ return (BigInt*)x;
8080 }
8181 }
8282}
@@ -169,7 +169,7 @@ VAL idris_bigPlus(VM* vm, VAL x, VAL y) {
169169 }
170170 i_int res = vx + vy;
171171 if (res >= 1<<30 || res <= -(1 << 30)) {
172− return bigAdd(vm, (VAL)GETBIG(vm, x), (VAL)GETBIG(vm, y));
172+ return bigAdd(vm, (VAL)GETBIG(vm, x), (VAL)GETBIG(vm, y));
173173 } else {
174174 return MKINT(res);
175175 }
@@ -200,15 +200,15 @@ VAL idris_bigTimes(VM* vm, VAL x, VAL y) {
200200 if (ISINT(x) && ISINT(y)) {
201201 i_int vx = GETINT(x);
202202 i_int vy = GETINT(y);
203− // we could work out likelihood of overflow by checking the number
204− // of necessary bits. Here's a quick conservative hack instead.
205− if ((vx < (1<<15) && vy < (1<16)) ||
206− (vx < (1<<16) && vy < (1<15)) ||
207− (vx < (1<<20) && vy < (1<11)) ||
208− (vx < (1<<11) && vy < (1<20)) ||
209− (vx < (1<<23) && vy < (1<<8)) ||
210− (vx < (1<<8) && vy < (1<<23))) { // ultra-conservative!
211− return INTOP(*,x,y);
203+ // we could work out likelihood of overflow by checking the number
204+ // of necessary bits. Here's a quick conservative hack instead.
205+ if ((vx < (1<<15) && vy < (1<16)) ||
206+ (vx < (1<<16) && vy < (1<15)) ||
207+ (vx < (1<<20) && vy < (1<11)) ||
208+ (vx < (1<<11) && vy < (1<20)) ||
209+ (vx < (1<<23) && vy < (1<<8)) ||
210+ (vx < (1<<8) && vy < (1<<23))) { // ultra-conservative!
211+ return INTOP(*,x,y);
212212 } else {
213213 return bigMul(vm, GETBIG(vm, x), GETBIG(vm, y));
214214 }