respect view rule radix in enum evaluations

This commit is contained in:
Ryan Fleury
2024-10-18 13:37:14 -07:00
parent 1865c33704
commit 53c624a27c
@@ -1595,15 +1595,16 @@ ev_string_from_simple_typed_eval(Arena *arena, EV_StringFlags flags, U32 radix,
break; break;
} }
} }
String8 numeric_value_string = str8_from_u64(scratch.arena, eval.value.u64, radix, min_digits, digit_group_separator);
if(flags & EV_StringFlag_ReadOnlyDisplayRules) if(flags & EV_StringFlag_ReadOnlyDisplayRules)
{ {
if(constant_name.size != 0) if(constant_name.size != 0)
{ {
result = push_str8f(arena, "0x%I64x (%S)", eval.value.u64, constant_name); result = push_str8f(arena, "%S (%S)", numeric_value_string, constant_name);
} }
else else
{ {
result = push_str8f(arena, "0x%I64x (%I64u)", eval.value.u64, eval.value.u64); result = push_str8_copy(arena, numeric_value_string);
} }
} }
else if(constant_name.size != 0) else if(constant_name.size != 0)
@@ -1612,7 +1613,7 @@ ev_string_from_simple_typed_eval(Arena *arena, EV_StringFlags flags, U32 radix,
} }
else else
{ {
result = push_str8f(arena, "0x%I64x (%I64u)", eval.value.u64, eval.value.u64); result = push_str8_copy(arena, numeric_value_string);
} }
scratch_end(scratch); scratch_end(scratch);
}break; }break;