Changeset 90349 in webkit for trunk/Source/JavaScriptCore/wtf/MathExtras.h
- Timestamp:
- Jul 3, 2011, 8:54:36 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/wtf/MathExtras.h
r90347 r90349 32 32 #include <limits> 33 33 #include <stdlib.h> 34 #include <wtf/StdLibExtras.h>35 34 36 35 #if OS(SOLARIS) … … 261 260 #endif 262 261 263 // decompose 'number' to its sign, exponent, and mantissa components.264 // The result is interpreted as:265 // (sign ? -1 : 1) * pow(2, exponent) * (mantissa / (1 << 52))266 inline void decomposeDouble(double number, bool& sign, int32_t& exponent, uint64_t& mantissa)267 {268 ASSERT(isfinite(number));269 270 sign = signbit(number);271 272 uint64_t bits = WTF::bitwise_cast<uint64_t>(number);273 exponent = (static_cast<int32_t>(bits >> 52) & 0x7ff) - 0x3ff;274 mantissa = bits & 0xFFFFFFFFFFFFFull;275 276 // Check for zero/denormal values; if so, adjust the exponent,277 // if not insert the implicit, omitted leading 1 bit.278 if (exponent == -0x3ff)279 exponent = mantissa ? -0x3fe : 0;280 else281 mantissa |= 0x10000000000000ull;282 }283 284 262 #endif // #ifndef WTF_MathExtras_h
Note:
See TracChangeset
for help on using the changeset viewer.