nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
30f6f57
)
lib/c: intro `CIntArray::from`
author
Alexis Laferrière
<alexis.laf@xymus.net>
Mon, 1 Dec 2014 01:53:06 +0000
(20:53 -0500)
committer
Alexis Laferrière
<alexis.laf@xymus.net>
Tue, 2 Dec 2014 15:18:43 +0000
(10:18 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib/c.nit
patch
|
blob
|
history
diff --git
a/lib/c.nit
b/lib/c.nit
index
1d11d0d
..
80701ab
100644
(file)
--- a/
lib/c.nit
+++ b/
lib/c.nit
@@
-75,6
+75,16
@@
class CIntArray
native_array = new NativeCIntArray(size)
super size
end
+
+ # Build from an `Array[Int]`
+ new from(array: Array[Int])
+ do
+ var carray = new CIntArray(array.length)
+ for i in array.length.times do
+ carray[i] = array[i]
+ end
+ return carray
+ end
end
# An array of `int` in C (`int*`)