From 92ac86ae3ca079d0485ed8b56fa45441b6c91356 Mon Sep 17 00:00:00 2001 From: Barinzaya Date: Mon, 7 Apr 2025 15:41:21 -0400 Subject: [PATCH] Fixed `fmt` handling of `bit_set[Enum]` when `min(Enum) != 0`. The lower bound of the `bit_set` was only being applied *after* searching for a matching enum value, so values wouldn't line up if the minimum value of the enum wasn't 0. --- core/fmt/fmt.odin | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/core/fmt/fmt.odin b/core/fmt/fmt.odin index 826a21ee9..f42ab700a 100644 --- a/core/fmt/fmt.odin +++ b/core/fmt/fmt.odin @@ -1802,11 +1802,8 @@ fmt_bit_set :: proc(fi: ^Info, v: any, name: string = "", verb: rune = 'v') { e, is_enum := et.variant.(runtime.Type_Info_Enum) commas := 0 - loop: for i in 0 ..< bit_size { - if bits & (1< 0 { io.write_string(fi.writer, ", ", &fi.n) } @@ -1829,8 +1826,7 @@ fmt_bit_set :: proc(fi: ^Info, v: any, name: string = "", verb: rune = 'v') { } } } - v := i64(i) + info.lower - io.write_i64(fi.writer, v, 10, &fi.n) + io.write_i64(fi.writer, i, 10, &fi.n) commas += 1 } }