mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
20 lines
532 B
C
20 lines
532 B
C
// Copyright (c) 2021 Christoffer Lerno. All rights reserved.
|
|
// Use of this source code is governed by the MIT license
|
|
// a copy of which can be found in the LICENSE_STDLIB file.
|
|
module std::array;
|
|
import std::mem;
|
|
|
|
macro make($Type, usize elements)
|
|
{
|
|
assert(elements > 0);
|
|
$Type* ptr = mem::alloc($sizeof($Type), elements);
|
|
return ptr[0..(elements - 1)];
|
|
}
|
|
|
|
macro make_zero($Type, usize elements)
|
|
{
|
|
assert(elements > 0);
|
|
$Type* ptr = mem::calloc($sizeof($Type), elements);
|
|
return ptr[0..(elements - 1)];
|
|
}
|