mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-18 03:42:23 -07:00
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.
This commit is contained in:
+3
-7
@@ -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<<i) == 0 {
|
||||
continue loop
|
||||
}
|
||||
|
||||
loop: for i in transmute(bit_set[0..<128])bits {
|
||||
i := i64(i) + info.lower
|
||||
if commas > 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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user