Suggest vector access methods to be inlined

This commit is contained in:
Tomas Jakobsson 2018-02-15 15:05:47 +01:00
parent dbcd749ae7
commit 5c6b29705a
5 changed files with 23 additions and 23 deletions

View file

@ -29,7 +29,7 @@ namespace Math
float bounce(const float _delayTime, const float _scrollTime, const float _currentTime, const float _scrollLength); float bounce(const float _delayTime, const float _scrollTime, const float _currentTime, const float _scrollLength);
float loop (const float _delayTime, const float _scrollTime, const float _currentTime, const float _scrollLength); float loop (const float _delayTime, const float _scrollTime, const float _currentTime, const float _scrollLength);
} // Math::Scroll:: } // Scroll::
} // Math:: } // Math::

View file

@ -46,10 +46,10 @@ public:
float& operator[](const int _index) { assert(_index < 2 && "index out of range"); return (&mX)[_index]; } float& operator[](const int _index) { assert(_index < 2 && "index out of range"); return (&mX)[_index]; }
const float& operator[](const int _index) const { assert(_index < 2 && "index out of range"); return (&mX)[_index]; } const float& operator[](const int _index) const { assert(_index < 2 && "index out of range"); return (&mX)[_index]; }
float& x() { return mX; } inline float& x() { return mX; }
float& y() { return mY; } inline float& y() { return mY; }
const float& x() const { return mX; } inline const float& x() const { return mX; }
const float& y() const { return mY; } inline const float& y() const { return mY; }
Vector2f& round(); Vector2f& round();
Vector2f& lerp (const Vector2f& _start, const Vector2f& _end, const float _fraction); Vector2f& lerp (const Vector2f& _start, const Vector2f& _end, const float _fraction);

View file

@ -40,10 +40,10 @@ public:
int& operator[](const int _index) { assert(_index < 2 && "index out of range"); return (&mX)[_index]; } int& operator[](const int _index) { assert(_index < 2 && "index out of range"); return (&mX)[_index]; }
const int& operator[](const int _index) const { assert(_index < 2 && "index out of range"); return (&mX)[_index]; } const int& operator[](const int _index) const { assert(_index < 2 && "index out of range"); return (&mX)[_index]; }
int& x() { return mX; } inline int& x() { return mX; }
int& y() { return mY; } inline int& y() { return mY; }
const int& x() const { return mX; } inline const int& x() const { return mX; }
const int& y() const { return mY; } inline const int& y() const { return mY; }
static const Vector2i Zero () { return { 0, 0 }; } static const Vector2i Zero () { return { 0, 0 }; }
static const Vector2i UnitX() { return { 1, 0 }; } static const Vector2i UnitX() { return { 1, 0 }; }

View file

@ -47,12 +47,12 @@ public:
float& operator[](const int _index) { assert(_index < 3 && "index out of range"); return (&mX)[_index]; } float& operator[](const int _index) { assert(_index < 3 && "index out of range"); return (&mX)[_index]; }
const float& operator[](const int _index) const { assert(_index < 3 && "index out of range"); return (&mX)[_index]; } const float& operator[](const int _index) const { assert(_index < 3 && "index out of range"); return (&mX)[_index]; }
float& x() { return mX; } inline float& x() { return mX; }
float& y() { return mY; } inline float& y() { return mY; }
float& z() { return mZ; } inline float& z() { return mZ; }
const float& x() const { return mX; } inline const float& x() const { return mX; }
const float& y() const { return mY; } inline const float& y() const { return mY; }
const float& z() const { return mZ; } inline const float& z() const { return mZ; }
inline Vector2f& v2() { return *(Vector2f*)this; } inline Vector2f& v2() { return *(Vector2f*)this; }
inline const Vector2f& v2() const { return *(Vector2f*)this; } inline const Vector2f& v2() const { return *(Vector2f*)this; }

View file

@ -49,14 +49,14 @@ public:
float& operator[](const int _index) { assert(_index < 4 && "index out of range"); return (&mX)[_index]; } float& operator[](const int _index) { assert(_index < 4 && "index out of range"); return (&mX)[_index]; }
const float& operator[](const int _index) const { assert(_index < 4 && "index out of range"); return (&mX)[_index]; } const float& operator[](const int _index) const { assert(_index < 4 && "index out of range"); return (&mX)[_index]; }
float& x() { return mX; } inline float& x() { return mX; }
float& y() { return mY; } inline float& y() { return mY; }
float& z() { return mZ; } inline float& z() { return mZ; }
float& w() { return mW; } inline float& w() { return mW; }
const float& x() const { return mX; } inline const float& x() const { return mX; }
const float& y() const { return mY; } inline const float& y() const { return mY; }
const float& z() const { return mZ; } inline const float& z() const { return mZ; }
const float& w() const { return mW; } inline const float& w() const { return mW; }
inline Vector2f& v2() { return *(Vector2f*)this; } inline Vector2f& v2() { return *(Vector2f*)this; }
inline const Vector2f& v2() const { return *(Vector2f*)this; } inline const Vector2f& v2() const { return *(Vector2f*)this; }