@@ -23,20 +23,25 @@ VAL MKBIGI(int val) {
2323}
2424
2525VAL MKBIGC(VM* vm, char* val) {
26− idris_requireAlloc(IDRIS_MAXGMP);
27− mpz_t* bigint;
28−
29− VAL cl = allocate(sizeof(Closure) + sizeof(mpz_t), 0);
30− idris_doneAlloc();
31− bigint = (mpz_t*)(((char*)cl) + sizeof(Closure));
32−
33− mpz_init(*bigint);
34− mpz_set_str(*bigint, val, 10);
26+ if (*val == '\0') {
27+ return MKBIGI(0);
28+ }
29+ else {
30+ idris_requireAlloc(IDRIS_MAXGMP);
31+ mpz_t* bigint;
32+
33+ VAL cl = allocate(sizeof(Closure) + sizeof(mpz_t), 0);
34+ idris_doneAlloc();
35+ bigint = (mpz_t*)(((char*)cl) + sizeof(Closure));
36+
37+ mpz_init(*bigint);
38+ mpz_set_str(*bigint, val, 10);
3539
36− SETTY(cl, CT_BIGINT);
37− cl -> info.ptr = (void*)bigint;
40+ SETTY(cl, CT_BIGINT);
41+ cl -> info.ptr = (void*)bigint;
3842
39− return cl;
43+ return cl;
44+ }
4045}
4146
4247VAL MKBIGM(VM* vm, void* big) {