Fix alignment for complex32 and quaternion64

This commit is contained in:
gingerBill
2021-04-01 11:10:17 +01:00
parent b3e788b9d9
commit 3e1b4c17ac

View File

@@ -2529,10 +2529,10 @@ Selection lookup_field_with_selection(Type *type_, String field_name, bool is_ty
gb_local_persist String x = str_lit("x");
gb_local_persist String y = str_lit("y");
gb_local_persist String z = str_lit("z");
gb_local_persist Entity *entity__w = alloc_entity_field(nullptr, make_token_ident(w), t_f32, false, 3);
gb_local_persist Entity *entity__x = alloc_entity_field(nullptr, make_token_ident(x), t_f32, false, 0);
gb_local_persist Entity *entity__y = alloc_entity_field(nullptr, make_token_ident(y), t_f32, false, 1);
gb_local_persist Entity *entity__z = alloc_entity_field(nullptr, make_token_ident(z), t_f32, false, 2);
gb_local_persist Entity *entity__w = alloc_entity_field(nullptr, make_token_ident(w), t_f16, false, 3);
gb_local_persist Entity *entity__x = alloc_entity_field(nullptr, make_token_ident(x), t_f16, false, 0);
gb_local_persist Entity *entity__y = alloc_entity_field(nullptr, make_token_ident(y), t_f16, false, 1);
gb_local_persist Entity *entity__z = alloc_entity_field(nullptr, make_token_ident(z), t_f16, false, 2);
if (field_name == w) {
selection_add_index(&sel, 3);
sel.entity = entity__w;
@@ -2823,9 +2823,9 @@ i64 type_align_of_internal(Type *t, TypePath *path) {
case Basic_int: case Basic_uint: case Basic_uintptr: case Basic_rawptr:
return build_context.word_size;
case Basic_complex64: case Basic_complex128:
case Basic_complex32: case Basic_complex64: case Basic_complex128:
return type_size_of_internal(t, path) / 2;
case Basic_quaternion128: case Basic_quaternion256:
case Basic_quaternion64: case Basic_quaternion128: case Basic_quaternion256:
return type_size_of_internal(t, path) / 4;
}
} break;