From 37ba226ae87ad85db064e025278d457b86f015e8 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Mon, 8 Jul 2024 19:06:48 +0200 Subject: Use hex for more compact representation --- src/codegen.c | 6 +++--- 1 file 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; -- cgit v1.2.3