From 76166167c9c12dbab3901eef8aa3e096b6125038 Mon Sep 17 00:00:00 2001 From: Max Wash Date: Wed, 21 Jan 2026 14:39:12 +0000 Subject: [PATCH] mie: builtin: improve int attribute print callback --- mie/dialect/builtin/attribute/int.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/mie/dialect/builtin/attribute/int.c b/mie/dialect/builtin/attribute/int.c index 39cacdb..ad20887 100644 --- a/mie/dialect/builtin/attribute/int.c +++ b/mie/dialect/builtin/attribute/int.c @@ -21,16 +21,25 @@ static enum mie_status print( b_stream_write_string(out->p_stream, "#builtin.int<", NULL); } - if (int_ty->i_width < 64 || !abbrev) { + if (int_ty->i_width <= 64) { b_stream_write_fmt( - out->p_stream, NULL, "%zu : i%zu", - int_val->i_val.v_small, int_ty->i_width); - } else if (int_ty->i_width == 64 && abbrev) { - b_stream_write_fmt( - out->p_stream, NULL, "%zu", int_val->i_val.v_small); + out->p_stream, NULL, "%zu", int_val->i_val.v_small, + int_ty->i_width); } else { - b_stream_write_fmt( - out->p_stream, NULL, "INF : i%zu", int_ty->i_width); + b_stream_write_fmt(out->p_stream, NULL, "INF", int_ty->i_width); + } + + if (int_ty->i_width != 64 || !abbrev) { + b_stream_write_string(out->p_stream, " : ", NULL); + + if (abbrev) { + b_stream_write_fmt( + out->p_stream, NULL, "i%zu", int_ty->i_width); + } else { + b_stream_write_fmt( + out->p_stream, NULL, "!builtin.int<%zu>", + int_ty->i_width); + } } if (!abbrev) {