mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 16:18:52 +00:00
Fix bit set size with 128-bit integers
This commit is contained in:
+2
-1
@@ -948,7 +948,8 @@ void check_bit_set_type(CheckerContext *c, Type *type, Type *named_type, Ast *no
|
|||||||
ast_node(bs, BitSetType, node);
|
ast_node(bs, BitSetType, node);
|
||||||
GB_ASSERT(type->kind == Type_BitSet);
|
GB_ASSERT(type->kind == Type_BitSet);
|
||||||
|
|
||||||
i64 const MAX_BITS = 64;
|
i64 const DEFAULT_BITS = cast(i64)(8*build_context.word_size);
|
||||||
|
i64 const MAX_BITS = 128;
|
||||||
|
|
||||||
Ast *base = unparen_expr(bs->elem);
|
Ast *base = unparen_expr(bs->elem);
|
||||||
if (is_ast_range(base)) {
|
if (is_ast_range(base)) {
|
||||||
|
|||||||
@@ -1243,6 +1243,7 @@ Type *bit_set_to_int(Type *t) {
|
|||||||
case 2: return t_u16;
|
case 2: return t_u16;
|
||||||
case 4: return t_u32;
|
case 4: return t_u32;
|
||||||
case 8: return t_u64;
|
case 8: return t_u64;
|
||||||
|
case 16: return t_u128;
|
||||||
}
|
}
|
||||||
GB_PANIC("Unknown bit_set size");
|
GB_PANIC("Unknown bit_set size");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -2418,6 +2419,7 @@ i64 type_align_of_internal(Type *t, TypePath *path) {
|
|||||||
if (bits <= 16) return 2;
|
if (bits <= 16) return 2;
|
||||||
if (bits <= 32) return 4;
|
if (bits <= 32) return 4;
|
||||||
if (bits <= 64) return 8;
|
if (bits <= 64) return 8;
|
||||||
|
if (bits <= 128) return 16;
|
||||||
return 8; // NOTE(bill): Could be an invalid range so limit it for now
|
return 8; // NOTE(bill): Could be an invalid range so limit it for now
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2669,6 +2671,7 @@ i64 type_size_of_internal(Type *t, TypePath *path) {
|
|||||||
if (bits <= 16) return 2;
|
if (bits <= 16) return 2;
|
||||||
if (bits <= 32) return 4;
|
if (bits <= 32) return 4;
|
||||||
if (bits <= 64) return 8;
|
if (bits <= 64) return 8;
|
||||||
|
if (bits <= 128) return 16;
|
||||||
return 8; // NOTE(bill): Could be an invalid range so limit it for now
|
return 8; // NOTE(bill): Could be an invalid range so limit it for now
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user