diff --git a/src/lol/math/half.h b/src/lol/math/half.h index 77e042cf..f5c6f597 100644 --- a/src/lol/math/half.h +++ b/src/lol/math/half.h @@ -73,8 +73,8 @@ public: 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; } + bool operator !() const { return !(bits & 0x7fffu); } + operator bool() const { return !!*this; } inline half operator -() const { return makebits(bits ^ 0x8000u); } inline half operator +() const { return *this; } diff --git a/src/lol/math/vector.h b/src/lol/math/vector.h index 3f1eef86..3e29081f 100644 --- a/src/lol/math/vector.h +++ b/src/lol/math/vector.h @@ -1225,6 +1225,12 @@ static inline Quat operator /(Quat x, Quat const &y) \ /* DECLARE_ALL_VECTOR_COERCE_OPS_INNER(tname, long double, real) */ +/* 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) @@ -1232,6 +1238,10 @@ DECLARE_ALL_VECTOR_OPS(Vec2) DECLARE_ALL_VECTOR_OPS(Vec3) DECLARE_ALL_VECTOR_OPS(Vec4) +#if defined _MSC_VER +# pragma warning(pop) +#endif + /* Disable warnings in the >= > etc. operators about comparing signed and * unsigned. Ideally we would like to get these warnings only when the * inlined operators are actually used, but they seem to be triggered at