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 |