Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/structures/ArrayTransform.xsac
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,23 @@ 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) \
Comment thread
rubenhensen marked this conversation as resolved.
{ \
return { iv -> _sel_VxA_(iv, p) ? _sel_VxA_(iv, A) : _sel_VxA_(iv, B); \
iv -> _zval | iv < shp }; \
}

#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 }; \
}

#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 }; \
Expand All @@ -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)

Expand Down
8 changes: 4 additions & 4 deletions src/structures/ComplexArrayArith.xsac
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@ 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 }; \
}

#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 }; \
}

#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 }; \
Expand All @@ -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 }; \
Expand Down
12 changes: 6 additions & 6 deletions src/structures/Quaternion.xsac
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
}
Loading