diff --git a/src/structures/ArrayTransform.xsac b/src/structures/ArrayTransform.xsac index eaabd952..10949fe1 100644 --- a/src/structures/ArrayTransform.xsac +++ b/src/structures/ArrayTransform.xsac @@ -56,7 +56,7 @@ BUILT_IN(TRANSPOSE) #define WHERE_AxA(typ, _postfix, _fmt, _zval, _oval) \ inline \ -typ[d:shp] where(bool[d:shp] p, typ[d:shp] A, typ[d:shp] B) \ +typ[d>0:shp] where(bool[d>0:shp] p, typ[d>0:shp] A, typ[d>0:shp] B) \ { \ return { iv -> _sel_VxA_(iv, p) ? _sel_VxA_(iv, A) : _sel_VxA_(iv, B); \ iv -> _zval | iv < shp }; \ @@ -64,7 +64,7 @@ typ[d:shp] where(bool[d:shp] p, typ[d:shp] A, typ[d:shp] B) \ #define WHERE_AxS(typ, _postfix, _fmt, _zval, _oval) \ inline \ -typ[d:shp] where(bool[d:shp] p, typ[d:shp] A, typ B) \ +typ[d>0:shp] where(bool[d>0:shp] p, typ[d>0:shp] A, typ B) \ { \ return { iv -> _sel_VxA_(iv, p) ? _sel_VxA_(iv, A) : B; \ iv -> _zval | iv < shp }; \ @@ -72,7 +72,7 @@ typ[d:shp] where(bool[d:shp] p, typ[d:shp] A, typ B) \ #define WHERE_SxA(typ, _postfix, _fmt, _zval, _oval) \ inline \ -typ[d:shp] where(bool[d:shp] p, typ A, typ[d:shp] B) \ +typ[d>0:shp] where(bool[d>0:shp] p, typ A, typ[d>0:shp] B) \ { \ return { iv -> _sel_VxA_(iv, p) ? A : _sel_VxA_(iv, B); \ iv -> _zval | iv < shp }; \ @@ -86,11 +86,19 @@ typ[b:shp] where(bool[b:shp] p, typ A, typ B) \ iv -> _zval | iv < shp }; \ } +#define WHERE_SSS(typ, _postfix, _fmt, _zval, _oval) \ +inline \ +typ where(bool p, typ A, typ B) \ +{ \ + return p ? A : B; \ +} + #define WHERE(typ, postfix, fmt, zval, oval) \ WHERE_AxA(typ, postfix, fmt, zval, oval) \ WHERE_AxS(typ, postfix, fmt, zval, oval) \ WHERE_SxA(typ, postfix, fmt, zval, oval) \ -WHERE_SxS(typ, postfix, fmt, zval, oval) +WHERE_SxS(typ, postfix, fmt, zval, oval) \ +WHERE_SSS(typ, postfix, fmt, zval, oval) BUILT_IN(WHERE) diff --git a/src/structures/ComplexArrayArith.xsac b/src/structures/ComplexArrayArith.xsac index 0b9a3557..91f46d39 100644 --- a/src/structures/ComplexArrayArith.xsac +++ b/src/structures/ComplexArrayArith.xsac @@ -21,7 +21,7 @@ export all; #define MAP_BIN_AxA(name, op, a, b, adef, bdef) \ inline \ -b[d:shp] name(a[d:shp] A, a[d:shp] B) \ +b[d>0:shp] name(a[d>0:shp] A, a[d>0:shp] B) \ { \ return { iv -> name(A[iv], B[iv]) | iv < shp; \ iv -> bdef | iv < shp }; \ @@ -29,7 +29,7 @@ b[d:shp] name(a[d:shp] A, a[d:shp] B) \ #define MAP_BIN_AxS(name, op, a, b, adef, bdef) \ inline \ -b[d:shp] name(a[d:shp] A, a B) \ +b[d>0:shp] name(a[d>0:shp] A, a B) \ { \ return { iv -> name(A[iv], B) | iv < shp; \ iv -> bdef | iv < shp }; \ @@ -37,7 +37,7 @@ b[d:shp] name(a[d:shp] A, a B) \ #define MAP_BIN_SxA(name, op, a, b, adef, bdef) \ inline \ -b[d:shp] name(a A, a[d:shp] B) \ +b[d>0:shp] name(a A, a[d>0:shp] B) \ { \ return { iv -> name(A, B[iv]) | iv < shp; \ iv -> bdef | iv < shp }; \ @@ -54,7 +54,7 @@ b[d:shp] name(a A, a[d:shp] B) \ #define MAP_MON_AxA(name, op, a, b, adef, bdef) \ inline \ -b[d:shp] name(a[d:shp] A) \ +b[d>0:shp] name(a[d>0:shp] A) \ { \ return { iv -> name(A[iv]) | iv < shp; \ iv -> bdef | iv < shp }; \ diff --git a/src/structures/Quaternion.xsac b/src/structures/Quaternion.xsac index ef12347d..be991d36 100644 --- a/src/structures/Quaternion.xsac +++ b/src/structures/Quaternion.xsac @@ -83,20 +83,20 @@ inline struct Quaternion *(struct Quaternion a, struct Quaternion b) }; } -inline struct Quaternion[d:shp] *(struct Quaternion a, - struct Quaternion[d:shp] b) +inline struct Quaternion[d>0:shp] *(struct Quaternion a, + struct Quaternion[d>0:shp] b) { return { iv -> a * b[iv] | iv < shp }; } -inline struct Quaternion[d:shp] *(struct Quaternion[d:shp] a, - struct Quaternion b) +inline struct Quaternion[d>0:shp] *(struct Quaternion[d>0:shp] a, + struct Quaternion b) { return { iv -> a[iv] * b | iv < shp }; } -inline struct Quaternion[d:shp] *(struct Quaternion[d:shp] a, - struct Quaternion[d:shp] b) +inline struct Quaternion[d>0:shp] *(struct Quaternion[d>0:shp] a, + struct Quaternion[d>0:shp] b) { return { iv -> a[iv] * b[iv] | iv < shp }; }