mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Bug due to missing cast when doing $i[$x] = $z.
Added `math::iota`.
This commit is contained in:
@@ -1145,6 +1145,18 @@ macro overflow_mul_helper(x, y) @local
|
||||
return res;
|
||||
}
|
||||
|
||||
<*
|
||||
@require types::is_vector($Type) || ($Type.kindof == ARRAY &&& types::is_numerical($typefrom($Type.inner)))
|
||||
*>
|
||||
macro iota($Type)
|
||||
{
|
||||
$Type $val = {};
|
||||
$for var $i = 0; $i < $Type.len; $i++:
|
||||
$val[$i] = $i;
|
||||
$endfor
|
||||
return $val;
|
||||
}
|
||||
|
||||
macro mul_div_helper(val, mul, div) @private
|
||||
{
|
||||
var $Type = $typeof(val);
|
||||
|
||||
Reference in New Issue
Block a user