Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(695)

Unified Diff: core/cross/math_utilities.cc

Issue 194061: This fixes some warnings in the Linux release build. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/cross/math_utilities.h ('k') | import/cross/memory_stream_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/cross/math_utilities.cc
===================================================================
--- core/cross/math_utilities.cc (revision 25801)
+++ core/cross/math_utilities.cc (working copy)
@@ -161,7 +161,6 @@
}
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 @@
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 @@
}
return sqrtf(sumOfElementsSquared);
}
+
+const float kPi = ::acosf(-1.0f);
} // namespace o3d
« no previous file with comments | « core/cross/math_utilities.h ('k') | import/cross/memory_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698