Replace reinterpret_cast with safer or no cast
When casting types to one another in C++, the weaker the cast,
the better.
This change replaces instances of reinterpret_cast with static_cast
or no cast where it safe and correct to do so.
BUG=angleproject:2683
Change-Id: I99c9033614a65282ae1d78cf0f4b80fabd75877a
Reviewed-on: https://chromium-review.googlesource.com/1109396
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/common/vector_utils.h b/src/common/vector_utils.h
index 9f5bee1..d23a836 100644
--- a/src/common/vector_utils.h
+++ b/src/common/vector_utils.h
@@ -367,7 +367,7 @@
{
mData[i] += other.mData[i];
}
- return *reinterpret_cast<Vector<Dimension, Type> *>(this);
+ return *static_cast<Vector<Dimension, Type> *>(this);
}
template <size_t Dimension, typename Type>
@@ -378,7 +378,7 @@
{
mData[i] -= other.mData[i];
}
- return *reinterpret_cast<Vector<Dimension, Type> *>(this);
+ return *static_cast<Vector<Dimension, Type> *>(this);
}
template <size_t Dimension, typename Type>
@@ -389,7 +389,7 @@
{
mData[i] *= other.mData[i];
}
- return *reinterpret_cast<Vector<Dimension, Type> *>(this);
+ return *static_cast<Vector<Dimension, Type> *>(this);
}
template <size_t Dimension, typename Type>
@@ -400,7 +400,7 @@
{
mData[i] /= other.mData[i];
}
- return *reinterpret_cast<Vector<Dimension, Type> *>(this);
+ return *static_cast<Vector<Dimension, Type> *>(this);
}
template <size_t Dimension, typename Type>
@@ -410,7 +410,7 @@
{
mData[i] *= other;
}
- return *reinterpret_cast<Vector<Dimension, Type> *>(this);
+ return *static_cast<Vector<Dimension, Type> *>(this);
}
template <size_t Dimension, typename Type>
@@ -420,7 +420,7 @@
{
mData[i] /= other;
}
- return *reinterpret_cast<Vector<Dimension, Type> *>(this);
+ return *static_cast<Vector<Dimension, Type> *>(this);
}
// Implementation of comparison operators