diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-07-08 19:06:48 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-07-08 19:06:48 +0200 |
commit | 37ba226ae87ad85db064e025278d457b86f015e8 (patch) | |
tree | 5ff59b64ce6f40d10fd7098875da2ffb6c8a48fa | |
parent | 1953e7ff4c24f6f41a4c9693aa60b97864db64fe (diff) |
Use hex for more compact representation
-rw-r--r-- | src/codegen.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/codegen.c b/src/codegen.c index 2f640e2..27f5277 100644 --- a/src/codegen.c +++ b/src/codegen.c @@ -151,9 +151,9 @@ codegentypedexpr(struct cgctx ctx, idx_t i, type_t *T, LLVMValueRef *outv) goto callstmt; if (T->kind == TYPE_NUM && TESTBIT(ctx.cnst, i) && !T->isfloat) { - char buf[40 /* The max value of a u128 is length 39 */]; - mpz_get_str(buf, 10, mpq_numref(ctx.folds[i].q)); - *outv = LLVMConstIntOfString(type2llvm(ctx, T), buf, 10); + char buf[128/4 + 1]; + mpz_get_str(buf, 16, mpq_numref(ctx.folds[i].q)); + *outv = LLVMConstIntOfString(type2llvm(ctx, T), buf, 16); return fwdnode(ctx.ast, i); } else if (T->kind == TYPE_NUM && TESTBIT(ctx.cnst, i)) { char *s, *buf; |