Make small integer constants actually constant
This commit is contained in:
parent
2383d73645
commit
20b7793963
@ -101,6 +101,7 @@ Int_t Int$sqrt(Int_t i);
|
||||
} while (0)
|
||||
|
||||
#define I(i) ((int64_t)(i) == (int32_t)(i) ? ((Int_t){.small=((uint64_t)(i)<<2)|1}) : Int64_to_Int(i))
|
||||
#define I_small(i) ((Int_t){.small=((uint64_t)(i)<<2)|1})
|
||||
|
||||
Int_t Int$slow_plus(Int_t x, Int_t y);
|
||||
Int_t Int$slow_minus(Int_t x, Int_t y);
|
||||
|
@ -1404,7 +1404,7 @@ CORD compile(env_t *env, ast_t *ast)
|
||||
switch (Match(ast, Int)->bits) {
|
||||
case 0:
|
||||
if (mpz_cmpabs_ui(i, BIGGEST_SMALL_INT) <= 0) {
|
||||
return CORD_asprintf("I(%s)", str);
|
||||
return CORD_asprintf("I_small(%s)", str);
|
||||
} else if (mpz_cmp_si(i, INT64_MAX) <= 0 && mpz_cmp_si(i, INT64_MIN) >= 0) {
|
||||
return CORD_asprintf("Int64_to_Int(%s)", str);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user