it can at last be put into a vector.legacy
@@ -66,7 +66,18 @@ public: | |||||
static size_t convert(float *dst, half const *src, size_t nelem); | static size_t convert(float *dst, half const *src, size_t nelem); | ||||
/* Operations */ | /* Operations */ | ||||
inline half operator -() { return makebits(bits ^ 0x8000u); } | |||||
bool operator ==(half x) const { return (float)*this == (float)x; } | |||||
bool operator !=(half x) const { return (float)*this != (float)x; } | |||||
bool operator <(half x) const { return (float)*this < (float)x; } | |||||
bool operator >(half x) const { return (float)*this > (float)x; } | |||||
bool operator <=(half x) const { return (float)*this <= (float)x; } | |||||
bool operator >=(half x) const { return (float)*this >= (float)x; } | |||||
bool operator !() const { return !(bool)*this; } | |||||
operator bool() const { return bits & 0x7fffu; } | |||||
inline half operator -() const { return makebits(bits ^ 0x8000u); } | |||||
inline half operator +() const { return *this; } | |||||
inline half &operator +=(float f) { return (*this = (half)(*this + f)); } | inline half &operator +=(float f) { return (*this = (half)(*this + f)); } | ||||
inline half &operator -=(float f) { return (*this = (half)(*this - f)); } | inline half &operator -=(float f) { return (*this = (half)(*this - f)); } | ||||
inline half &operator *=(float f) { return (*this = (half)(*this * f)); } | inline half &operator *=(float f) { return (*this = (half)(*this * f)); } | ||||
@@ -1052,10 +1052,8 @@ static inline Quat<T> operator /(Quat<T> x, Quat<T> const &y) | |||||
DECLARE_BOOL_OP(tname, <, <, true, tprefix, T) \ | DECLARE_BOOL_OP(tname, <, <, true, tprefix, T) \ | ||||
DECLARE_BOOL_OP(tname, >, >, true, tprefix, T) | DECLARE_BOOL_OP(tname, >, >, true, tprefix, T) | ||||
/* FIXME: a few problems need to be fixed before we can use "half" here. It | |||||
* will probably never work until we switch to C++11 because it's not really | |||||
* a POD class. */ | |||||
#define DECLARE_GLOBAL_TYPED_OPS(tname) \ | #define DECLARE_GLOBAL_TYPED_OPS(tname) \ | ||||
DECLARE_ALL_GLOBAL_OPS(tname, /* empty */, half) \ | |||||
DECLARE_ALL_GLOBAL_OPS(tname, /* empty */, float) \ | DECLARE_ALL_GLOBAL_OPS(tname, /* empty */, float) \ | ||||
DECLARE_ALL_GLOBAL_OPS(tname, /* empty */, double) \ | DECLARE_ALL_GLOBAL_OPS(tname, /* empty */, double) \ | ||||
DECLARE_ALL_GLOBAL_OPS(tname, /* empty */, int8_t) \ | DECLARE_ALL_GLOBAL_OPS(tname, /* empty */, int8_t) \ | ||||