mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-24 06:35:00 -07:00
Add ..< operator for ranges; Add extra checking for bit set assignments
This commit is contained in:
+12
-2
@@ -1044,8 +1044,18 @@ void check_bit_set_type(CheckerContext *c, Type *type, Type *named_type, Ast *no
|
||||
bits = 8*type_size_of(type->BitSet.underlying);
|
||||
}
|
||||
|
||||
if (upper - lower >= bits) {
|
||||
error(bs->elem, "bit_set range is greater than %lld bits, %lld bits are required", bits, (upper-lower+1));
|
||||
switch (be->op.kind) {
|
||||
case Token_Ellipsis:
|
||||
if (upper - lower >= bits) {
|
||||
error(bs->elem, "bit_set range is greater than %lld bits, %lld bits are required", bits, (upper-lower+1));
|
||||
}
|
||||
break;
|
||||
case Token_RangeHalf:
|
||||
if (upper - lower > bits) {
|
||||
error(bs->elem, "bit_set range is greater than %lld bits, %lld bits are required", bits, (upper-lower));
|
||||
}
|
||||
upper -= 1;
|
||||
break;
|
||||
}
|
||||
type->BitSet.elem = t;
|
||||
type->BitSet.lower = lower;
|
||||
|
||||
Reference in New Issue
Block a user