diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/datatype.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/datatype.c b/src/datatype.c index f93337b1..82a77537 100644 --- a/src/datatype.c +++ b/src/datatype.c @@ -260,15 +260,22 @@ const struct datatype bitmask_type = { .type = TYPE_BITMASK, .name = "bitmask", .desc = "bitmask", + .basefmt = "0x%Zx", .basetype = &integer_type, }; static void integer_type_print(const struct expr *expr) { + const struct datatype *dtype = expr->dtype; const char *fmt = "%Zu"; - if (expr->dtype->basefmt != NULL) - fmt = expr->dtype->basefmt; + do { + if (dtype->basefmt != NULL) { + fmt = dtype->basefmt; + break; + } + } while ((dtype = dtype->basetype)); + gmp_printf(fmt, expr->value); } |