mirror of
https://github.com/odin-lang/Odin.git
synced 2026-08-14 01:34:35 +00:00
Merge pull request #7308 from kalsprite/extract_lsbs_limit
simd_extract_lsbs/_msbs: reject a lane count that exceeds the bit_set limit
This commit is contained in:
@@ -1441,6 +1441,13 @@ gb_internal bool check_builtin_simd_operation(CheckerContext *c, Operand *operan
|
||||
}
|
||||
|
||||
i64 num_elems = get_array_type_count(x.type);
|
||||
// the range is taken from the lane count; it has to meet the same limit a written bit_set does
|
||||
if (num_elems > 128) {
|
||||
gbString xs = type_to_string(x.type);
|
||||
error(x.expr, "'%.*s' would produce a bit_set of %lld bits, exceeding the maximum of 128, got '%s'", LIT(builtin_name), cast(long long)num_elems, xs);
|
||||
gb_string_free(xs);
|
||||
return false;
|
||||
}
|
||||
|
||||
Type *result_type = alloc_type_bit_set();
|
||||
result_type->BitSet.elem = t_int;
|
||||
|
||||
Reference in New Issue
Block a user