mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00: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)
|
e, is_enum := et.variant.(runtime.Type_Info_Enum)
|
||||||
commas := 0
|
commas := 0
|
||||||
loop: for i in 0 ..< bit_size {
|
loop: for i in transmute(bit_set[0..<128])bits {
|
||||||
if bits & (1<<i) == 0 {
|
i := i64(i) + info.lower
|
||||||
continue loop
|
|
||||||
}
|
|
||||||
|
|
||||||
if commas > 0 {
|
if commas > 0 {
|
||||||
io.write_string(fi.writer, ", ", &fi.n)
|
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, i, 10, &fi.n)
|
||||||
io.write_i64(fi.writer, v, 10, &fi.n)
|
|
||||||
commas += 1
|
commas += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user