forked from M-Labs/artiq
language/core: add array function
This commit is contained in:
parent
1bf2142785
commit
f410b4d241
|
@ -1,5 +1,6 @@
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from fractions import Fraction
|
from fractions import Fraction
|
||||||
|
from copy import copy
|
||||||
|
|
||||||
from artiq.language import units
|
from artiq.language import units
|
||||||
|
|
||||||
|
@ -35,6 +36,10 @@ def round64(x):
|
||||||
return int64(round(x))
|
return int64(round(x))
|
||||||
|
|
||||||
|
|
||||||
|
def array(element, count):
|
||||||
|
return [copy(element) for i in range(count)]
|
||||||
|
|
||||||
|
|
||||||
def _make_kernel_ro(value):
|
def _make_kernel_ro(value):
|
||||||
return isinstance(
|
return isinstance(
|
||||||
value, (bool, int, int64, float, Fraction, units.Quantity))
|
value, (bool, int, int64, float, Fraction, units.Quantity))
|
||||||
|
|
Loading…
Reference in New Issue