diff --git a/src/lol/math/vector.h b/src/lol/math/vector.h index 39266a18..12bb4600 100644 --- a/src/lol/math/vector.h +++ b/src/lol/math/vector.h @@ -71,12 +71,12 @@ template struct XVec2 { inline Vec2 operator =(Vec2 const &that); - inline T& operator[](int n) + inline T& operator[](size_t n) { int i = (N >> (4 * (1 - n))) & 3; return static_cast(static_cast(this))[i]; } - inline T const& operator[](int n) const + inline T const& operator[](size_t n) const { int i = (N >> (4 * (1 - n))) & 3; return static_cast(static_cast(this))[i]; @@ -87,12 +87,12 @@ template struct XVec3 { inline Vec3 operator =(Vec3 const &that); - inline T& operator[](int n) + inline T& operator[](size_t n) { int i = (N >> (4 * (2 - n))) & 3; return static_cast(static_cast(this))[i]; } - inline T const& operator[](int n) const + inline T const& operator[](size_t n) const { int i = (N >> (4 * (2 - n))) & 3; return static_cast(static_cast(this))[i]; @@ -103,12 +103,12 @@ template struct XVec4 { inline Vec4 operator =(Vec4 const &that); - inline T& operator[](int n) + inline T& operator[](size_t n) { int i = (N >> (4 * (3 - n))) & 3; return static_cast(static_cast(this))[i]; } - inline T const& operator[](int n) const + inline T const& operator[](size_t n) const { int i = (N >> (4 * (3 - n))) & 3; return static_cast(static_cast(this))[i]; @@ -120,8 +120,8 @@ template struct XVec4 */ #define DECLARE_MEMBER_OPS(tname) \ - inline T& operator[](int n) { return *(&this->x + n); } \ - inline T const& operator[](int n) const { return *(&this->x + n); } \ + inline T& operator[](size_t n) { return *(&this->x + n); } \ + inline T const& operator[](size_t n) const { return *(&this->x + n); } \ \ /* Visual Studio insists on having an assignment operator. */ \ inline tname const & operator =(tname const &that) \ @@ -1350,8 +1350,8 @@ template struct Mat4 v2((T)0, (T)0, val, (T)0), v3((T)0, (T)0, (T)0, val) {} - inline Vec4& operator[](int n) { return (&v0)[n]; } - inline Vec4 const& operator[](int n) const { return (&v0)[n]; } + inline Vec4& operator[](size_t n) { return (&v0)[n]; } + inline Vec4 const& operator[](size_t n) const { return (&v0)[n]; } T det() const; Mat4 invert() const;