mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-21 22:05:20 +00:00
Generalize to any 1-byte element in bit_field
This commit is contained in:
@@ -1134,12 +1134,13 @@ gb_internal void check_bit_field_type(CheckerContext *ctx, Type *bit_field_type,
|
||||
};
|
||||
|
||||
Type *backing_type_elem = core_array_type(backing_type);
|
||||
i64 backing_type_elem_size = type_size_of(backing_type_elem);
|
||||
EndianKind backing_type_endian_kind = determine_endian_kind(backing_type_elem);
|
||||
EndianKind endian_kind = Endian_Unknown;
|
||||
for (Entity *f : fields) {
|
||||
EndianKind field_kind = determine_endian_kind(f->type);
|
||||
|
||||
if (field_kind && backing_type_endian_kind != field_kind && backing_type_elem != t_u8) {
|
||||
if (field_kind && backing_type_endian_kind != field_kind && 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");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user