8 template<typename type>
16 Array(uint32_t _size) :
17 array((type *) ourcalloc(1, sizeof(type) * _size)),
22 Array(type *_array, uint _size) :
23 array((type *) ourmalloc(sizeof(type) * _size)),
25 memcpy(array, _array, _size * sizeof(type));
28 Array(Array<type> *_array) :
29 array((type *) ourmalloc(sizeof(type) * _array->size)),
31 memcpy(array, _array->array, size * sizeof(type));
34 void init(uint _size) {
35 array = (type *) ourcalloc(1, sizeof(type) * _size);
39 void init(type *_array, uint _size) {
40 array = (type *) ourmalloc(sizeof(type) * _size);
42 memcpy(array, _array, _size * sizeof(type));
45 void init(Array<type> *_array) {
46 array = (type *) ourmalloc(sizeof(type) * _array->size);
48 memcpy(array, _array->array, size * sizeof(type));
56 type get(uint index) const {
60 void set(uint index, type item) {
68 type *internalArray() {
77 template<typename type>
78 void System_arraycopy(Array<type> * src, int32_t srcPos, Array<type> *dst, int32_t dstPos, int32_t len) {
79 if (srcPos + len > src->length() ||
80 dstPos + len > dst->length())
82 uint bytesToCopy = len * sizeof(type);
83 memcpy(&dst->internalArray()[dstPos], &src->internalArray()[srcPos], bytesToCopy);