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