diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-02-06 16:40:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-06 16:40:59 +0100 |
commit | e38df41de8f20516ab8b2c91bedb4388cd9e41aa (patch) | |
tree | b3823839f7d1ba31b3e118d5585de0233146a1a9 /core/math/vector2.h | |
parent | 762a31169d5e0939fda5bdaab537cec5ab39f870 (diff) | |
parent | 8c7268664da7ef98f802ec90fa2ba17b4d695847 (diff) |
Merge pull request #57607 from reduz/fix-variant-vec-integer-float-mul-div
Diffstat (limited to 'core/math/vector2.h')
-rw-r--r-- | core/math/vector2.h | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/core/math/vector2.h b/core/math/vector2.h index 9edaaebf89..123e3dc7b6 100644 --- a/core/math/vector2.h +++ b/core/math/vector2.h @@ -180,22 +180,6 @@ _FORCE_INLINE_ Vector2 Vector2::plane_project(const real_t p_d, const Vector2 &p return p_vec - *this * (dot(p_vec) - p_d); } -_FORCE_INLINE_ Vector2 operator*(const float p_scalar, const Vector2 &p_vec) { - return p_vec * p_scalar; -} - -_FORCE_INLINE_ Vector2 operator*(const double p_scalar, const Vector2 &p_vec) { - return p_vec * p_scalar; -} - -_FORCE_INLINE_ Vector2 operator*(const int32_t p_scalar, const Vector2 &p_vec) { - return p_vec * p_scalar; -} - -_FORCE_INLINE_ Vector2 operator*(const int64_t p_scalar, const Vector2 &p_vec) { - return p_vec * p_scalar; -} - _FORCE_INLINE_ Vector2 Vector2::operator+(const Vector2 &p_v) const { return Vector2(x + p_v.x, y + p_v.y); } @@ -280,6 +264,25 @@ Vector2 Vector2::direction_to(const Vector2 &p_to) const { return ret; } +// Multiplication operators required to workaround issues with LLVM using implicit conversion +// to Vector2i instead for integers where it should not. + +_FORCE_INLINE_ Vector2 operator*(const float p_scalar, const Vector2 &p_vec) { + return p_vec * p_scalar; +} + +_FORCE_INLINE_ Vector2 operator*(const double p_scalar, const Vector2 &p_vec) { + return p_vec * p_scalar; +} + +_FORCE_INLINE_ Vector2 operator*(const int32_t p_scalar, const Vector2 &p_vec) { + return p_vec * p_scalar; +} + +_FORCE_INLINE_ Vector2 operator*(const int64_t p_scalar, const Vector2 &p_vec) { + return p_vec * p_scalar; +} + typedef Vector2 Size2; typedef Vector2 Point2; |