summaryrefslogtreecommitdiffstats
path: root/o3d/core
diff options
context:
space:
mode:
authorbradnelson@google.com <bradnelson@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-09 22:26:24 +0000
committerbradnelson@google.com <bradnelson@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-09 22:26:24 +0000
commit87fce2b91c8fa1f10ec49e79c719159097a597c5 (patch)
treed08dce8d43dd30a90a301cdeea1d53449d5cbd7a /o3d/core
parentbc2a2dd4edbc70339be723c5820d1e5b92fe9236 (diff)
downloadchromium_src-87fce2b91c8fa1f10ec49e79c719159097a597c5.zip
chromium_src-87fce2b91c8fa1f10ec49e79c719159097a597c5.tar.gz
chromium_src-87fce2b91c8fa1f10ec49e79c719159097a597c5.tar.bz2
This fixes some warnings in the Linux release build.
Review URL: http://codereview.chromium.org/194061 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25802 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/core')
-rw-r--r--o3d/core/cross/math_utilities.cc11
-rw-r--r--o3d/core/cross/math_utilities.h6
2 files changed, 9 insertions, 8 deletions
diff --git a/o3d/core/cross/math_utilities.cc b/o3d/core/cross/math_utilities.cc
index c91e7fb..fd3f498 100644
--- a/o3d/core/cross/math_utilities.cc
+++ b/o3d/core/cross/math_utilities.cc
@@ -161,7 +161,6 @@ uint16 FloatToHalf(float value) {
}
float HalfToFloat(uint16 half) {
- unsigned int value;
unsigned int sign = static_cast<unsigned int>(half >> 15);
unsigned int mantissa = static_cast<unsigned int>(half & ((1 << 10) - 1));
unsigned int exponent = static_cast<unsigned int>(
@@ -198,8 +197,12 @@ float HalfToFloat(uint16 half) {
exponent = (exponent << 13) + kHalfFloatMinBiasedExpAsSingleFpExponent;
}
- value = (sign << 31) | exponent | mantissa;
- return *((float *)&value);
+ union {
+ unsigned int int_value;
+ float float_value;
+ } value;
+ value.int_value = (sign << 31) | exponent | mantissa;
+ return value.float_value;
}
} // namespace Vectormath
@@ -225,4 +228,6 @@ float FrobeniusNorm(const Matrix4& matrix) {
}
return sqrtf(sumOfElementsSquared);
}
+
+const float kPi = ::acosf(-1.0f);
} // namespace o3d
diff --git a/o3d/core/cross/math_utilities.h b/o3d/core/cross/math_utilities.h
index c4ee147..4ba556e 100644
--- a/o3d/core/cross/math_utilities.h
+++ b/o3d/core/cross/math_utilities.h
@@ -79,11 +79,7 @@ float FrobeniusNorm(const Matrix3& matrix);
// See http://en.wikipedia.org/wiki/Matrix_norm
float FrobeniusNorm(const Matrix4& matrix);
-const float kPi = acosf(-1.0f);
+extern const float kPi;
} // namespace o3d
#endif // O3D_CORE_CROSS_MATH_UTILITIES_H_
-
-
-
-