summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authorPeter Mikkelsen <petermikkelsen10@gmail.com>2022-01-22 12:37:48 +0000
committerPeter Mikkelsen <petermikkelsen10@gmail.com>2022-01-22 12:37:48 +0000
commit26ee5089659da12e3c060edfefd056e2196b4363 (patch)
tree399784a877bc56b043e150dfb0ca96798c3e9398 /array.c
parent9dad240ddfbe770ddfc8e1556d77328696a6734c (diff)
Implement scalar functions via a macro
Diffstat (limited to 'array.c')
-rw-r--r--array.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/array.c b/array.c
index 2e0e71e..bf75a1b 100644
--- a/array.c
+++ b/array.c
@@ -138,6 +138,16 @@ commontype(Array *a, Array *b, Array **aa, Array **bb, int forcefloat)
}else if(a->type == AtypeInt && b->type == AtypeFloat){
*aa = inttofloatarray(a);
*bb = fnSame(b);
+ }else if(a->type == AtypeArray && b->type != AtypeArray){
+ *aa = fnSame(a);
+ *bb = allocarray(AtypeArray, 0, 1);
+ (*bb)->arraydata[0] = b;
+ incref(b);
+ }else if(a->type != AtypeArray && b->type == AtypeArray){
+ *aa = allocarray(AtypeArray, 0, 1);
+ (*aa)->arraydata[0] = a;
+ incref(a);
+ *bb = fnSame(b);
}else
return 0;
return 1;