From d0350fd2b634e73e8f6ef2a0927ae2decef81602 Mon Sep 17 00:00:00 2001 From: Peter Mikkelsen Date: Sat, 22 Jan 2022 14:18:09 +0000 Subject: =?UTF-8?q?Implement=20<=20=E2=89=A4=20=3D=20=E2=89=A5=20>=20?= =?UTF-8?q?=E2=89=A0,=20but=20=3D=20and=20=E2=89=A0=20doesn't=20compare=20?= =?UTF-8?q?runes=20with=20numbers=20yet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- array.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'array.c') diff --git a/array.c b/array.c index bf75a1b..b6bc87b 100644 --- a/array.c +++ b/array.c @@ -50,8 +50,7 @@ mkrunearray(Rune *str) Array * duparray(Array *a) { - Array *b = allocarray(a->type, a->rank, a->size); - memcpy(b->shape, a->shape, sizeof(int) * a->rank); + Array *b = duparrayshape(a, a->type); memcpy(b->rawdata, a->rawdata, datasizes[a->type]*a->size); if(b->type == AtypeArray) for(int i = 0; i < b->size; i++) @@ -59,6 +58,14 @@ duparray(Array *a) return b; } +Array * +duparrayshape(Array *a, int type) +{ + Array *b = allocarray(type, a->rank, a->size); + memcpy(b->shape, a->shape, sizeof(int) * a->rank); + return b; +} + int simplearray(Array *a) { -- cgit v1.2.3