mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-12 13:28:11 +00:00
Fix another oversight for bit_field endian with 1-byte types
This commit is contained in:
@@ -1139,14 +1139,15 @@ gb_internal void check_bit_field_type(CheckerContext *ctx, Type *bit_field_type,
|
||||
EndianKind endian_kind = Endian_Unknown;
|
||||
for (Entity *f : fields) {
|
||||
EndianKind field_kind = determine_endian_kind(f->type);
|
||||
i64 field_size = type_size_of(f->type);
|
||||
|
||||
if (field_kind && backing_type_endian_kind != field_kind && backing_type_elem_size > 1) {
|
||||
if (field_kind && backing_type_endian_kind != field_kind && field_size > 1 && backing_type_elem_size > 1) {
|
||||
error(f->token, "All 'bit_field' field types must match the same endian kind as the backing type, i.e. all native, all little, or all big");
|
||||
}
|
||||
|
||||
if (endian_kind == Endian_Unknown) {
|
||||
endian_kind = field_kind;
|
||||
} else if (field_kind && endian_kind != field_kind) {
|
||||
} else if (field_kind && endian_kind != field_kind && field_size > 1) {
|
||||
error(f->token, "All 'bit_field' field types must be of the same endian variety, i.e. all native, all little, or all big");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user