From ce99d79babc53c26ef33431c8365c7fb27a64a8a Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Wed, 12 Mar 2014 02:41:23 -0400 Subject: [PATCH] Add some static casts --- Base/include/VectorBase.h | 6 +++--- Base/test/TestVector.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Base/include/VectorBase.h b/Base/include/VectorBase.h index e313b90..df64c1d 100644 --- a/Base/include/VectorBase.h +++ b/Base/include/VectorBase.h @@ -94,7 +94,7 @@ namespace FasTC { } T LengthSq() const { return this->Dot(*this); } - T Length() const { return sqrt(LengthSq()); } + T Length() const { return static_cast(sqrt(LengthSq())); } void Normalize() { T len = Length(); @@ -110,7 +110,7 @@ namespace FasTC { const VectorTypeTwo &v2) { VectorTypeOne a(v1); for(int i = 0; i < VectorTypeOne::Size; i++) { - a(i) += v2[i]; + a(i) += static_cast(v2[i]); } return a; } @@ -132,7 +132,7 @@ namespace FasTC { const VectorTypeTwo &v2) { VectorTypeOne a(v1); for(int i = 0; i < VectorTypeOne::Size; i++) { - a(i) -= v2[i]; + a(i) -= static_cast(v2[i]); } return a; } diff --git a/Base/test/TestVector.cpp b/Base/test/TestVector.cpp index 7735fdc..5b6b756 100644 --- a/Base/test/TestVector.cpp +++ b/Base/test/TestVector.cpp @@ -225,7 +225,7 @@ TEST(VectorBase, Addition) { EXPECT_NEAR(af[1], 5.2f, kEpsilon); au = v2u - v2f; - EXPECT_EQ(au[0], 3); + EXPECT_EQ(au[0], 4); EXPECT_EQ(au[1], -1); af = v2f - v2u;