mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-30 11:20:08 +00:00
Add underlying type for bit_set
This commit is contained in:
+5
-1
@@ -355,7 +355,11 @@ write_type :: proc(buf: ^String_Buffer, ti: ^runtime.Type_Info) {
|
||||
write_string(buf, "..");
|
||||
write_i64(buf, info.upper, 10);
|
||||
}
|
||||
write_string(buf, "]");
|
||||
if info.underlying != nil {
|
||||
write_string(buf, "; ");
|
||||
write_type(buf, info.underlying);
|
||||
}
|
||||
write_byte(buf, ']');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
-3
@@ -100,9 +100,10 @@ Type_Info_Bit_Field :: struct {
|
||||
offsets: []i32,
|
||||
};
|
||||
Type_Info_Bit_Set :: struct {
|
||||
elem: ^Type_Info,
|
||||
lower: i64,
|
||||
upper: i64,
|
||||
elem: ^Type_Info,
|
||||
underlying: ^Type_Info, // Possibly nil
|
||||
lower: i64,
|
||||
upper: i64,
|
||||
};
|
||||
|
||||
Type_Info :: struct {
|
||||
@@ -427,6 +428,14 @@ reserve_dynamic_array :: proc(array: ^$T/[dynamic]$E, capacity: int, loc := #cal
|
||||
return true;
|
||||
}
|
||||
|
||||
@(builtin)
|
||||
incl :: proc(s: ^$B/bit_set[$T], elem: T) {
|
||||
s^ |= {elem};
|
||||
}
|
||||
@(builtin)
|
||||
excl :: proc(s: ^$B/bit_set[$T], elem: T) {
|
||||
s^ &~= {elem};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user