Add intrinsics type_fixed_capacity_dynamic_array_len_offset and type_is_fixed_capacity_dynamic_array

This commit is contained in:
gingerBill
2026-03-12 17:39:44 +00:00
parent c7308d86d4
commit 8e23c58620
4 changed files with 37 additions and 1 deletions

View File

@@ -4755,8 +4755,9 @@ gb_internal i64 type_offset_of(Type *t, i64 index, Type **field_type_) {
case 1: // len
if (field_type_) *field_type_ = t_int;
{
i64 elem_size = type_size_of(t->FixedCapacityDynamicArray.elem);
i64 offset = 0;
offset = type_size_of(alloc_type_array(t->FixedCapacityDynamicArray.elem, t->FixedCapacityDynamicArray.capacity));
offset = elem_size * t->FixedCapacityDynamicArray.capacity;
offset = align_formula(offset, build_context.int_size);
return offset;
}