Begin work adding bit_field

This commit is contained in:
gingerBill
2024-02-22 15:55:20 +00:00
parent b12ba1508e
commit a4b8c1ea17
16 changed files with 535 additions and 2 deletions
+7 -1
View File
@@ -2719,6 +2719,7 @@ gb_internal bool lb_generate_code(lbGenerator *gen) {
{ // Type info member buffer
// NOTE(bill): Removes need for heap allocation by making it global memory
isize count = 0;
isize offsets_extra = 0;
for (Type *t : m->info->type_info_types) {
isize index = lb_type_info_index(m->info, t, false);
@@ -2736,6 +2737,11 @@ gb_internal bool lb_generate_code(lbGenerator *gen) {
case Type_Tuple:
count += t->Tuple.variables.count;
break;
case Type_BitField:
count += t->BitField.fields.count;
// Twice is needed for the bit_offsets
offsets_extra += t->BitField.fields.count;
break;
}
}
@@ -2752,7 +2758,7 @@ gb_internal bool lb_generate_code(lbGenerator *gen) {
lb_global_type_info_member_types = global_type_info_make(m, LB_TYPE_INFO_TYPES_NAME, t_type_info_ptr, count);
lb_global_type_info_member_names = global_type_info_make(m, LB_TYPE_INFO_NAMES_NAME, t_string, count);
lb_global_type_info_member_offsets = global_type_info_make(m, LB_TYPE_INFO_OFFSETS_NAME, t_uintptr, count);
lb_global_type_info_member_offsets = global_type_info_make(m, LB_TYPE_INFO_OFFSETS_NAME, t_uintptr, count+offsets_extra);
lb_global_type_info_member_usings = global_type_info_make(m, LB_TYPE_INFO_USINGS_NAME, t_bool, count);
lb_global_type_info_member_tags = global_type_info_make(m, LB_TYPE_INFO_TAGS_NAME, t_string, count);
}