|
|
@@ -1123,7 +1123,7 @@ static inline Quat<T> operator /(Quat<T> x, Quat<T> const &y) |
|
|
|
\ |
|
|
|
DECLARE_VEC_3_COERCE_OPS(Vec3, static, type, type, type) |
|
|
|
|
|
|
|
#define DECLARE_ALL_VECTOR_COERCE_OPS_INNER(tname, tlow, thigh) \ |
|
|
|
#define DECLARE_VEC_ANY_COERCE_OPS(tname, tlow, thigh) \ |
|
|
|
DECLARE_BINARY_COERCE_OPS(tname, static, tlow, thigh, thigh) \ |
|
|
|
DECLARE_BINARY_COERCE_OPS(tname, static, thigh, tlow, thigh) \ |
|
|
|
\ |
|
|
@@ -1131,22 +1131,22 @@ static inline Quat<T> operator /(Quat<T> x, Quat<T> const &y) |
|
|
|
DECLARE_VECTOR_COERCE_OPS(tname, static, thigh, tlow, thigh) |
|
|
|
|
|
|
|
#define DECLARE_ALL_VECTOR_COERCE_OPS(tlow, thigh) \ |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS_INNER(Vec2, tlow, thigh) \ |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS_INNER(Vec3, tlow, thigh) \ |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS_INNER(Vec4, tlow, thigh) \ |
|
|
|
DECLARE_VEC_ANY_COERCE_OPS(Vec2, tlow, thigh) \ |
|
|
|
DECLARE_VEC_ANY_COERCE_OPS(Vec3, tlow, thigh) \ |
|
|
|
DECLARE_VEC_ANY_COERCE_OPS(Vec4, tlow, thigh) \ |
|
|
|
\ |
|
|
|
DECLARE_VEC_3_COERCE_OPS(Vec3, static, tlow, thigh, thigh) \ |
|
|
|
DECLARE_VEC_3_COERCE_OPS(Vec3, static, thigh, tlow, thigh) |
|
|
|
|
|
|
|
DECLARE_ALL_NONVECTOR_OPS(Cmplx) |
|
|
|
DECLARE_ALL_NONVECTOR_OPS(Quat) |
|
|
|
|
|
|
|
/* Disable warning about unary operator applied to unsigned type */ |
|
|
|
#if defined _MSC_VER |
|
|
|
# pragma warning(push) |
|
|
|
# pragma warning(disable: 4146) |
|
|
|
#endif |
|
|
|
|
|
|
|
DECLARE_ALL_NONVECTOR_OPS(Cmplx) |
|
|
|
DECLARE_ALL_NONVECTOR_OPS(Quat) |
|
|
|
|
|
|
|
DECLARE_ALL_VECTOR_OPS(half) |
|
|
|
DECLARE_ALL_VECTOR_OPS(float) |
|
|
|
DECLARE_ALL_VECTOR_OPS(double) |
|
|
@@ -1178,10 +1178,9 @@ DECLARE_ALL_VECTOR_OPS(uint64_t) |
|
|
|
# pragma warning(disable: 4018) |
|
|
|
#endif |
|
|
|
|
|
|
|
/* Apply the same coercion rules as in the C++ standard. However, */ |
|
|
|
/* instead of promoting int8_t etc. to int, we apply our own rules. */ |
|
|
|
/* FIXME: "half" and "real" are deactivated for now, because we do */ |
|
|
|
/* not implement all combinations of operators for these types yet. */ |
|
|
|
/* Apply the same coercion rules as in the C++ standard. However, instead |
|
|
|
* of always promoting smaller types to int, we allow int8_t op int16_t to |
|
|
|
* return an int16_t. */ |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int8_t, uint8_t) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int8_t, int16_t) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int8_t, uint16_t) |
|
|
@@ -1189,11 +1188,9 @@ DECLARE_ALL_VECTOR_COERCE_OPS(int8_t, int32_t) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int8_t, uint32_t) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int8_t, int64_t) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int8_t, uint64_t) |
|
|
|
/* DECLARE_ALL_VECTOR_COERCE_OPS(int8_t, half) */ |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int8_t, float) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int8_t, double) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int8_t, long double) |
|
|
|
/* DECLARE_ALL_VECTOR_COERCE_OPS(int8_t, real) */ |
|
|
|
|
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint8_t, int16_t) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint8_t, uint16_t) |
|
|
@@ -1201,76 +1198,87 @@ DECLARE_ALL_VECTOR_COERCE_OPS(uint8_t, int32_t) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint8_t, uint32_t) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint8_t, int64_t) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint8_t, uint64_t) |
|
|
|
/* DECLARE_ALL_VECTOR_COERCE_OPS(uint8_t, half) */ |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint8_t, float) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint8_t, double) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint8_t, long double) |
|
|
|
/* DECLARE_ALL_VECTOR_COERCE_OPS(uint8_t, real) */ |
|
|
|
|
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int16_t, uint16_t) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int16_t, int32_t) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int16_t, uint32_t) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int16_t, int64_t) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int16_t, uint64_t) |
|
|
|
/* DECLARE_ALL_VECTOR_COERCE_OPS(int16_t, half) */ |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int16_t, float) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int16_t, double) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int16_t, long double) |
|
|
|
/* DECLARE_ALL_VECTOR_COERCE_OPS(int16_t, real) */ |
|
|
|
|
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint16_t, int32_t) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint16_t, uint32_t) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint16_t, int64_t) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint16_t, uint64_t) |
|
|
|
/* DECLARE_ALL_VECTOR_COERCE_OPS(uint16_t, half) */ |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint16_t, float) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint16_t, double) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint16_t, long double) |
|
|
|
/* DECLARE_ALL_VECTOR_COERCE_OPS(uint16_t, real) */ |
|
|
|
|
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int32_t, uint32_t) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int32_t, int64_t) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int32_t, uint64_t) |
|
|
|
/* DECLARE_ALL_VECTOR_COERCE_OPS(int32_t, half) */ |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int32_t, float) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int32_t, double) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int32_t, long double) |
|
|
|
/* DECLARE_ALL_VECTOR_COERCE_OPS(int32_t, real) */ |
|
|
|
|
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint32_t, int64_t) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint32_t, uint64_t) |
|
|
|
/* DECLARE_ALL_VECTOR_COERCE_OPS(uint32_t, half) */ |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint32_t, float) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint32_t, double) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint32_t, long double) |
|
|
|
/* DECLARE_ALL_VECTOR_COERCE_OPS(uint32_t, real) */ |
|
|
|
|
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int64_t, uint64_t) |
|
|
|
/* DECLARE_ALL_VECTOR_COERCE_OPS(int64_t, half) */ |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int64_t, float) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int64_t, double) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int64_t, long double) |
|
|
|
/* DECLARE_ALL_VECTOR_COERCE_OPS(int64_t, real) */ |
|
|
|
|
|
|
|
/* DECLARE_ALL_VECTOR_COERCE_OPS(uint64_t, half) */ |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint64_t, float) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint64_t, double) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint64_t, long double) |
|
|
|
/* DECLARE_ALL_VECTOR_COERCE_OPS(uint64_t, real) */ |
|
|
|
|
|
|
|
/* DECLARE_ALL_VECTOR_COERCE_OPS(half, float) */ |
|
|
|
/* DECLARE_ALL_VECTOR_COERCE_OPS(half, double) */ |
|
|
|
/* DECLARE_ALL_VECTOR_COERCE_OPS(half, long double) */ |
|
|
|
/* DECLARE_ALL_VECTOR_COERCE_OPS(half, real) */ |
|
|
|
|
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(float, double) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(float, long double) |
|
|
|
/* DECLARE_ALL_VECTOR_COERCE_OPS(float, real) */ |
|
|
|
|
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(double, long double) |
|
|
|
/* DECLARE_ALL_VECTOR_COERCE_OPS(double, real) */ |
|
|
|
|
|
|
|
/* DECLARE_ALL_VECTOR_COERCE_OPS(long double, real) */ |
|
|
|
/* All integer types are promoted to half; all floating point types |
|
|
|
* cause half to be promoted. */ |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int8_t, half) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint8_t, half) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int16_t, half) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint16_t, half) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int32_t, half) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint32_t, half) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int64_t, half) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint64_t, half) |
|
|
|
|
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(half, float) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(half, double) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(half, long double) |
|
|
|
|
|
|
|
/* FIXME: vectors of "real" are deactivated for now, because we do |
|
|
|
* not implement all combinations of operators for these types yet. */ |
|
|
|
|
|
|
|
#if 0 |
|
|
|
/* All types are promoted to real */ |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int8_t, real) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint8_t, real) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int16_t, real) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint16_t, real) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int32_t, real) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint32_t, real) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(int64_t, real) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(uint64_t, real) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(half, real) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(float, real) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(double, real) |
|
|
|
DECLARE_ALL_VECTOR_COERCE_OPS(long double, real) |
|
|
|
#endif |
|
|
|
|
|
|
|
#if defined __GNUC__ && (__GNUC__ >= 4) |
|
|
|
# pragma GCC diagnostic pop |
|
|
|