mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2024-11-28 05:04:16 +01:00
Add some static casts
This commit is contained in:
parent
ebfd8f8f81
commit
ce99d79bab
@ -94,7 +94,7 @@ namespace FasTC {
|
|||||||
}
|
}
|
||||||
|
|
||||||
T LengthSq() const { return this->Dot(*this); }
|
T LengthSq() const { return this->Dot(*this); }
|
||||||
T Length() const { return sqrt(LengthSq()); }
|
T Length() const { return static_cast<T>(sqrt(LengthSq())); }
|
||||||
|
|
||||||
void Normalize() {
|
void Normalize() {
|
||||||
T len = Length();
|
T len = Length();
|
||||||
@ -110,7 +110,7 @@ namespace FasTC {
|
|||||||
const VectorTypeTwo &v2) {
|
const VectorTypeTwo &v2) {
|
||||||
VectorTypeOne a(v1);
|
VectorTypeOne a(v1);
|
||||||
for(int i = 0; i < VectorTypeOne::Size; i++) {
|
for(int i = 0; i < VectorTypeOne::Size; i++) {
|
||||||
a(i) += v2[i];
|
a(i) += static_cast<VectorTypeOne::ScalarType>(v2[i]);
|
||||||
}
|
}
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
@ -132,7 +132,7 @@ namespace FasTC {
|
|||||||
const VectorTypeTwo &v2) {
|
const VectorTypeTwo &v2) {
|
||||||
VectorTypeOne a(v1);
|
VectorTypeOne a(v1);
|
||||||
for(int i = 0; i < VectorTypeOne::Size; i++) {
|
for(int i = 0; i < VectorTypeOne::Size; i++) {
|
||||||
a(i) -= v2[i];
|
a(i) -= static_cast<VectorTypeOne::ScalarType>(v2[i]);
|
||||||
}
|
}
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ TEST(VectorBase, Addition) {
|
|||||||
EXPECT_NEAR(af[1], 5.2f, kEpsilon);
|
EXPECT_NEAR(af[1], 5.2f, kEpsilon);
|
||||||
|
|
||||||
au = v2u - v2f;
|
au = v2u - v2f;
|
||||||
EXPECT_EQ(au[0], 3);
|
EXPECT_EQ(au[0], 4);
|
||||||
EXPECT_EQ(au[1], -1);
|
EXPECT_EQ(au[1], -1);
|
||||||
|
|
||||||
af = v2f - v2u;
|
af = v2f - v2u;
|
||||||
|
Loading…
Reference in New Issue
Block a user