mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Handle any correctly for 32-bit systems
This commit is contained in:
@@ -1784,11 +1784,20 @@ gb_internal LLVMTypeRef lb_type_internal(lbModule *m, Type *type) {
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
type = LLVMStructCreateNamed(ctx, name);
|
type = LLVMStructCreateNamed(ctx, name);
|
||||||
LLVMTypeRef fields[2] = {
|
if (build_context.ptr_size == 4) {
|
||||||
lb_type(m, t_rawptr),
|
LLVMTypeRef fields[3] = {
|
||||||
lb_type(m, t_typeid),
|
lb_type(m, t_rawptr),
|
||||||
};
|
lb_type_padding_filler(m, build_context.ptr_size, build_context.ptr_size), // padding
|
||||||
LLVMStructSetBody(type, fields, 2, false);
|
lb_type(m, t_typeid),
|
||||||
|
};
|
||||||
|
LLVMStructSetBody(type, fields, 3, false);
|
||||||
|
} else {
|
||||||
|
LLVMTypeRef fields[2] = {
|
||||||
|
lb_type(m, t_rawptr),
|
||||||
|
lb_type(m, t_typeid),
|
||||||
|
};
|
||||||
|
LLVMStructSetBody(type, fields, 2, false);
|
||||||
|
}
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -971,6 +971,13 @@ gb_internal i32 lb_convert_struct_index(lbModule *m, Type *t, i32 index) {
|
|||||||
if (t->kind == Type_Struct) {
|
if (t->kind == Type_Struct) {
|
||||||
auto field_remapping = lb_get_struct_remapping(m, t);
|
auto field_remapping = lb_get_struct_remapping(m, t);
|
||||||
return field_remapping[index];
|
return field_remapping[index];
|
||||||
|
} else if (is_type_any(t) && build_context.ptr_size == 4) {
|
||||||
|
GB_ASSERT(t->kind == Type_Basic);
|
||||||
|
GB_ASSERT(t->Basic.kind == Basic_any);
|
||||||
|
switch (index) {
|
||||||
|
case 0: return 0; // data
|
||||||
|
case 1: return 2; // id
|
||||||
|
}
|
||||||
} else if (build_context.ptr_size != build_context.int_size) {
|
} else if (build_context.ptr_size != build_context.int_size) {
|
||||||
switch (t->kind) {
|
switch (t->kind) {
|
||||||
case Type_Basic:
|
case Type_Basic:
|
||||||
|
|||||||
Reference in New Issue
Block a user