mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
17 lines
348 B
Plaintext
17 lines
348 B
Plaintext
module std::array;
|
|
import std::mem;
|
|
|
|
macro make($Type, usize elements)
|
|
{
|
|
assert(elements > 0);
|
|
$Type* ptr = mem::alloc($Type.sizeof, elements);
|
|
return ptr[0..(elements - 1)];
|
|
}
|
|
|
|
macro make_zero($Type, usize elements)
|
|
{
|
|
assert(elements > 0);
|
|
$Type* ptr = mem::calloc($Type.sizeof, elements);
|
|
return ptr[0..(elements - 1)];
|
|
}
|